我正在嘗試爲.doc文件寫入阿拉伯語句子。但是,每次打開.doc文件時,它都會顯示一條消息,說明文件轉換,並詢問要在哪個Unicode中顯示.doc文件,以便保留Unicode(UTF-8),並且一切順利。寫入.doc文件
這裏就是我寫文件的代碼:
PrintWriter print = new PrintWriter(new FileOutputStream(newFile+".doc", true));
print.println(toString());
print.println();
print.close();
凡newFile
是由用戶選擇的文件(從用戶添加沒有擴展名)和toString()
是結合全句是一個函數寫在文件上。
我的問題是,每次打開.doc文件時都必須看到此文件轉換嗎?
我已經嘗試在net beans中打開項目的屬性,並把編碼:UTF-8!
任何人都可以幫忙嗎?
任何API你使用或簡單文件IO? – 2013-02-27 14:17:59
你如何編寫.doc文件?你是否使用POI或任何其他庫?如果沒有,那麼你*幾乎可以肯定*做錯了。 – 2013-02-27 14:18:17
好的,這裏是我寫入文件的代碼: PrintWriter print = new PrintWriter(new FileOutputStream(newFile +「。doc」,true)); print.println(toString()); print.println(); print.close(); 其中newFile是用戶選擇的文件(沒有從用戶添加的擴展名),toSting()是一個函數,它將整個句子結合在文件上。 – 2013-02-27 14:44:38