土耳其字符的小写字母点缀我 [英] lower case of turkish character dotted i

查看:96
本文介绍了土耳其字符的小写字母点缀我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java 6中,

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

打印i(u0069),但是在Java 7中,它用双点(u0069 u0307)打印i.

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

我知道这是土耳其语字符,但是如何使用此代码使Java 7输出与v6相同的输出?

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());

还要确保代码可以处理国际文本,而无需对toLowerCase函数进行硬编码以仅使用土耳其语区域设置.

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

推荐答案

有一个非常详细的让我尝试总结以下重要部分:

Let me try to summarize the essential parts:

在Java 7中,此方法的确发生了变化,并且处理此字符的方式与Java 6不同.添加了以下代码:

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:

基本上,此更改的最终结果是针对此特定情况 (大写的虚线I),Java 7现在使用特殊的Unicode 角色数据库 ( http://www.unicode.org/Public/UNIDATA/SpecialCasing.txt), 提供有关复杂案例映射的数据.查看此文件,您可以 看到几行大写的虚线I:

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;

这篇关于土耳其字符的小写字母点缀我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆