Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to create an UTF-8 file.

807591Apr 7 2008 — edited Apr 7 2008
Hello,

I want to create a file with an UTF-8 encoding, but I am experiencing a lot of problems.

The problem is not in the encoding of the content but in the encoding of the file. What is happening is that if I open the file with an editor (ex. ULTRA-Edit), it doesn�t recognize the file as an UTF-8 file and some strange characters are displayed.
However, if I tell the editor that the file is a UTF-8 file the content is displayed as desired.

The content that I want put in the file is a XML, and I did another test. I open the file in a web browser, and it displays the characters in a correct way. Considering this, I can conclude that the content is well encoded, and the encoding of the file is not defined (maybe I have to put something in the header of the file that indicates the encoding of the file)

For me, it works fine in the web browser, because the encoding is defined in the preamble of the XML file, which indicates that the following content is encoded in UTF-8.

Does anybody know how to define the encoding in the file in order to say to the editor in which encoding the information is coded?

Regards,

Rui Torres
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 5 2008
Added on Apr 7 2008
10 comments
624 views