wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes unicode problem in HTMLEditorKit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "unicode problem in HTMLEditorKit" Watch "unicode problem in HTMLEditorKit" New topic
Author

unicode problem in HTMLEditorKit

Stephen Lee
Ranch Hand

Joined: Dec 11, 2001
Posts: 74
My program use StringWriter to get the unicode in a HTMLEditorKit by this code:
Writer textOut = new StringWriter();
htmlEditorkit.write(str, doc, start, end);
The string I got from this method is in the format of decimal unicode (e.g. 雅). Actually, I do not mind that it is in this format. However, I need to save this string into a file with the format of UTF-8. I have tried to use the following codes:
FileOutputStream fos = new FileOutputStream(new File(fileName));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
out.write(str);
...
However, the content in the file saved is still in the format of decimal unicode.
How can I get the file with the content in the UTF-8? Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unicode problem in HTMLEditorKit
 
Similar Threads
OutOfMemoryError while Data above 16 MB
Unable to Write the file in UTF-8
unicode problem in htmleditorkit
Null teminating a string
Reg : Encode in UTF-8 with BOM