Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lower case of turkish character dotted i

In Java 6,

System.out.println(String.valueOf('\u0130').toLowerCase());

prints i (u0069), but in Java 7 it prints i with double dots (u0069 u0307).

I understand it is a Turkish character, but how do I make Java 7 print the same output as v6 using this code?

System.out.println(inputText.toLowerCase());

Also make sure that the code can handle international text without hardcoding the toLowerCase function to use only Turkish locale.

like image 600
ikirankumar Avatar asked May 07 '14 17:05

ikirankumar


People also ask

Why does Turkish have a Dotless I?

I, or ı, called dotless I, is a letter used in the Latin-script alphabets of Azerbaijani, Crimean Tatar, Gagauz, Kazakh, Tatar, and Turkish. It commonly represents the close back unrounded vowel /ɯ/, except in Kazakh where it represents the near-close front unrounded vowel /ɪ/.

How do you type a Dotless I?

You can also input a dotless I with the keyboard shortcut Shift + Option + B or Shift + Alt + B.

Is there a dot on capital ı?

A tittle or superscript dot is a small distinguishing mark, such as a diacritic in the form of a dot on a letter (for example, lowercase i or j). The tittle is an integral part of the glyph of i and j, but diacritic dots can appear over other letters in various languages.

How is ı without a dot pronounced?

As a matter of fact, the lowercase version of this is a dotless i (ı). It has no exact English equivalent, but is pronounced like the e in legend or i in cousin. The exact pronunciation is made by shaping your lips to say e (as in bread), but trying to say u (as in you) instead.


1 Answers

There is a quite detailed blog post about this i toLowerCase problem


Let me try to summarize the essential parts:

In Java 7 this method has indeed changed and handles this char differently than Java 6. The following code was added:

} else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
    lowerChar = Character.ERROR;
}

==> This change results in the following way:

Basically the end result of this change is that for this specific case (the upper-case dotted I), Java 7 now consults a special Unicode character database (http://www.unicode.org/Public/UNIDATA/SpecialCasing.txt), which provides data on complex case-mappings. Looking at this file you can see several lines for the upper-case dotted I:

CODE       LOWER   TITLE   UPPER  LANGUAGE
0130;  0069 0307;   0130;   0130;
0130;  0069;        0130;   0130;       tr;
0130;  0069;        0130;   0130;       az;
like image 167
donfuxx Avatar answered Sep 18 '22 23:09

donfuxx