I wanted code to convert all the characters in strings to uppercase or lowercase in Java.
I found a method that goes something like this:
public static String changelowertoupper()
{
String str = "CyBeRdRaGoN";
str=str.toLowerCase(Locale.ENGLISH);
return str;
}
Now I’ve read that using certain Locales, like Turkish, “returns i (without dot) instead of i (with dot).”
Is it safe to use Locales like UK, US, ENGLISH, etc.? Are there any big differences between them when applied to strings?
Which is the most preferred Locale for Strings?
I think you should use locale ,
I refer to these links as solution to your problem
and it has point to keep in mind in you situation "Turkish"
reference 1
reference 2
reference 3
Dotless-i, is a lowercase ‘i’ without dot. The uppercase of this character is the usual "I". There is another character, "I with dot". The lowercase of this character is the usual lowercase "i".
Have you noticed the problem? This unsymetrical conversion causes a serious problem in programming. We face this problem mostly in Java applications because of (IMHO) poor implementation of toLowerCase and toUpperCase functions.
In Java, String.toLowerCase() method converts characters to lowercase according to the default locale. This causes problems if your application works in Turkish locale and especially if you are using this function for a file name or a url that must obey a certain character set.
I have blogged about two serious examples before: The compile errors with Script libraries with "i" in their names and XSP Manager’s fault if an XPage is in a database with "I" in its name.
There is a long history, as I said. For instance in some R7 version, router was unable to send a message to a recipient if his/her name starts with "I". Message reporting agents was not running in Turkish locale until R8. Anyone with Turkish locale could not install Lotus Notes 8.5.1 (it’s real!). The list goes on…
There is almost no beta tester from Turkey and customers don’t open PMR for these problems. So these problems are not going up to the first priority for development teams.
Even Java team has added a special warning to the latest documentation: