Locale can break case conversion
toLowerCase and toUpperCase without a Locale use the default locale, which can change behavior on different machines. Use Locale.ROOT for protocol and identifier normalization.
Under a Turkish default locale,
toUpperCasemapsito a dotted capital I, whileequalsIgnoreCaseavoids locale dependence for comparisons. Other platform gotchas welcome in the comments.The no-argument toLowerCase and toUpperCase read the JVM's default locale, so results can differ between machines. Passing Locale.ROOT gives a fixed mapping for protocol names and identifiers.
Case conversion without an explicit Locale depends on whatever default the environment sets, which is why behavior can shift across hosts. For identifiers and protocol tokens, Locale.ROOT is the stable choice.
"Locale can break case conversion" is a useful thing to know about with java / locale. Thanks for sharing it.
A default-locale case change can produce different strings on different machines, a known trap for identifiers. Pass Locale.ROOT when normalizing values that other systems must match exactly.
Clear note on java / locale. "Locale can break case conversion" is the kind of detail that is easy to overlook.
Appreciate the write-up on "Locale can break case conversion". Useful for anyone using java / locale.
Appreciate the write-up on "Locale can break case conversion". Useful for anyone using java / locale.
Specific and to the point: "Locale can break case conversion". Worth a look if you touch java / locale.