タイ文字を含むRTFファイルを読み込んでテキストファイルに書き込む必要があります。私はTIS-620、MS874、ISO-8859-11を使ってみましたが、結果の出力ファイルをメモ帳やテキストパッドで開くと、タイ文字が正しく表示されません。しかし、それはワードパッドでうまくいく。私を案内してください。タイ文字の文字エンコーディング
ありがとうございました。 Ramya。
問題を解決したコード(それは読みやすくするためにここに追加して、コメントに投稿!):
FileInputStream fin = new FileInputStream(fileName);
DataInputStream din = new DataInputStream(fin);
//creating a default blank styled document
DefaultStyledDocument styledDoc = new DefaultStyledDocument();
//Creating a RTF Editor kit
RTFEditorKit rtfKit = new RTFEditorKit();
//Populating the contents in the blank styled document
rtfKit.read(din,styledDoc,0);
// Getting the root document
Document doc = styledDoc.getDefaultRootElement().getDocument();
//Printing out the contents of the RTF document as plain text
System.out.println(doc.getText(0,doc.getLength()));
出力ファイルもRTFですか? –
出力ファイルはテキストファイルではありません。 下記のコードで問題を解決しました。 –