I am having trouble with Greek and Turkish when using toUpperCase() with the default locale or more interestingly the two argument Locale constructor.
Issue happens on Galaxy Tab S2 Android 5.0.2 (also reproduced on 5.1.1)
The Issue is reproducible via BOTH the Settings App AND MoreLocale 2
Considering this value for title: Τέλος συνεδρίας
These calls work fine.
title.toUpperCase(new Locale("el_GR"))
title.toUpperCase(new Locale("el-GR"))
Both generate the correct result. If you look closely there are tick marks after the T and the P.
ΤΈΛΟΣ ΣΥΝΕΔΡΊΑΣ
However, I get a different result for the default locale and the two-argument Locale constructor.
This is the default Locale on my tablet:
Locale.getDefault() == el_GR
Which is used in the generic toUpperCase()
public String toUpperCase() {
return CaseMapper.toUpperCase(Locale.getDefault(), this, value, offset, count);
}
When I call this it returns the incorrect result.
title.toUpperCase()
Note the missing tick marks on the T and P.
ΤΕΛΟΣ ΣΥΝΕΔΡΙΑΣ
I get the same result if I use the two argument constructor for a new locale:
title.toUpperCase(new Locale("el","GR"))
ΤΕΛΟΣ ΣΥΝΕΔΡΙΑΣ
Adding these lines to application startup resolves the issues but is rather hackish.
String language = Locale.getDefault().getLanguage();
String country = Locale.getDefault().getCountry();
Locale.setDefault(new Locale(language + "-" + country));
I would prefer to simply defer to the default locale.