在我的包,我想顯示UTF-8字符,我想我的默認字符集是CP1250和奇怪的現象發生了:OSGi包不顯示UTF-8字符
public class Activator implements BundleActivator {
public void start(BundleContext context) throws Exception {
System.out.println("ąśżłóę"); // this is what should've been displayed
System.out.println("������"); // this is the utf8 above encoded to cp1250
}
public void stop(BundleContext context) throws Exception {
}
public static void main(String args[]){
System.out.println("ąśżłóę"); //utf-8
System.out.println("������"); //cp1250
}
}
輸出,當我運行主,我得到了我的預期:
ąśżłóę
ąśżłóę
輸出,當我開始從一個OSGi框架捆綁包,字符從UTF-8編碼爲CP1250。所以輸出完全相反。
ąśżłóę
ąęźł
所以我的問題是:如何處理它?我應該用cp1250而不是utf-8編寫應用程序嗎?或者是否有可能更改osgi默認字符集?
你的開發環境是什麼?該包是否使用與非osgi代碼相同的進程構建? –