태국어 문자가있는 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입니까? –
출력 파일이 텍스트 파일이 아닙니다. 아래 게시 된 코드로 문제를 해결했습니다. –