2017-04-18 38 views
0

我在我的java項目中遇到了國際化問題。用於翻譯中文時的國際化

將英文單詞翻譯爲中文時,某些字符會顯示爲問號。

public static void main(String[] args) 
{ 
    String lang="ch"; 
    String country="CH"; 
    Locale l=new Locale(lang,country);  
    ResourceBundle r = ResourceBundle.getBundle("com.neomandi.prototype/Bundle_ch_CH",l); 
    String val = r.getString("average"); 
    System.out.println(st);  
} 

我不能在eclipse中粘貼中文單詞。當我這樣做時,它變爲\u5E73\u5747

回答

1

似乎有配置問題。 在Eclipse中粘貼unicode字符將編碼更改爲unicode。 對於輸出中顯示的unicode字符,更新運行配置。 enter image description here