3 ms·
Java has two variants of toLowerCase(): one which uses the default/current locale (almost never what you want), and one which receives an explicit locale (Local
by cesarb 6y ago
Java has two variants of toLowerCase(): one which uses the default/current locale (almost never what you want), and one which receives an explicit locale (Locale.ROOT is almost always the one you want). At work, we use the "forbidden APIs" checker (https://github.com/policeman-tools/forbidden-apis https://github.com/policeman-tools/forbidden-apis) to fail the CI if the variant which uses the default locale is ever used; if you really want to use a locale-dependent toLowerCase(), you have to explicitly call Locale.getDefault() and use it as the locale.
Is there something similar for C and C++? It could help in your case, by making your well-meaning colleagues aware of the issue.
- rvnx 6y agoYes, tolower_l(string, locale)
- vesinisa 6y ago> Locale.ROOT is almost always the one you want At least Android developers are advised to use Locale.US: https://developer.android.com/reference/java/util/Locale https://developer.android.com/reference/java/util/Locale > The default locale is not appropriate for machine-readable output. The best choice there is usually Locale.US – this locale is guaranteed to be available on all devices, and the fact that it has no surprising special cases and is frequently used It would be indeed interesting to see in which features these two locales actually differ.