[
https://issues.apache.org/jira/browse/HDFS-8705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15037061#comment-15037061
]
Walter Su commented on HDFS-8705:
---------------------------------
Hi [[email protected]]. I think {{String.equalsIgnoreCase()}} is pretty safe.
{code}
public static void main(String[] args) {
System.out.println(Locale.getDefault()); // zh_CN
// Locale trlocale = new Locale("tr", "TR");
// Locale.setDefault(trlocale);
// System.out.println(Locale.getDefault()); // tr_TR
String dottedUpper = "\u0130";
String dottedLower = "\u0069";
String dotlessUpper = "\u0049";
String dotlessLower = "\u0131";
System.out.println(dottedUpper);
System.out.println(dottedLower);
System.out.println(dotlessUpper);
System.out.println(dotlessLower);
System.out.println(dottedLower.toUpperCase().equals("I")); // true, false
System.out.println(dotlessLower.toUpperCase().equals("I")); // true
System.out.println(dottedUpper.equals("I")); // false
System.out.println(dotlessUpper.equals("I")); // true
System.out.println(dottedUpper.equalsIgnoreCase("I")); // true
System.out.println(dotlessUpper.equalsIgnoreCase("I")); // true
System.out.println(dottedLower.equalsIgnoreCase("I")); // true
System.out.println(dotlessLower.equalsIgnoreCase("I")); // true
}
{code}
See [link|http://www.i18nguy.com/unicode/turkish-i18n.html]
> BlockStoragePolicySuite uses equalsIgnoreCase for name lookup, won't work in
> all locales
> ----------------------------------------------------------------------------------------
>
> Key: HDFS-8705
> URL: https://issues.apache.org/jira/browse/HDFS-8705
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: namenode
> Affects Versions: 2.8.0
> Reporter: Steve Loughran
> Assignee: Brahma Reddy Battula
> Priority: Minor
> Attachments: HDFS-8705-002.patch, HDFS-8705.patch
>
>
> Looking at {{BlockStoragePolicySuite.getPolicy(name)}}, is using
> {{equalsIgnoreCase()}} to find a policy which matches a name.
> This will not work in all locales. It must use
> {{toLowerCase(Locale.ENGLISH).equals(name)}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)