我正在使用Windows XP支持我的语言Urdu。 IDE是JCreator。我面临的问题是,对于我的项目来说,如果我能够直接在我的代码中使用乌尔都语文本就很容易,但不幸的是它无法正常工作。任何帮助将不胜感激。
// urWord是方法参数
中的任何单词 String s = "\u0628\u0627\u067e";
String trial = "باپ";
int comparison = s.compareTo(urWord);
System.out.println (urWord);
System.out.println (comparison);
//works perfectly
if(s.equals(urWord)){
System.out.println ("Strings are equal");
}
//does not work
if(s.equals(trial)){
System.out.println ("Strings are equal");
}
答案 0 :(得分:1)
如果您的文件使用任何类型的Unicode指定编码进行编码,这应该可行。因此,请检查用于Java源代码的编码的IDE配置。