It's not a secret anymore!
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "unicode problem in HTMLEditorKit" Watch "unicode problem in HTMLEditorKit" New topic

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"));
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:
subject: unicode problem in HTMLEditorKit
It's not a secret anymore!