0
我正在使用支持我的語言烏爾都語的Windows XP。 IDE是JCreator。我面臨的問題是,對於我的項目來說,如果我能夠直接在我的代碼中使用烏爾都語文本,那很容易,但不幸的是它不工作。任何幫助,將不勝感激。爲什麼我不能直接在我的代碼中使用unicode字符串文字
// 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");
}
你的代碼適用於我,s等於審判,如果我通過命令行參數將urdu字傳遞給'urWord',它也可以工作。一切都是平等的。所以你很可能在你的IDE,操作系統或任何你得到'urWord'的地方都有編碼問題。 – nif
在UTF-8編碼的源代碼中,如何使用utf-8文字? http://utf8everywhere.org –