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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Converting UTF-16LE to UTF-8

807569Aug 15 2006 — edited Aug 15 2006
Hi Guys,

I've got a weird situation. I'm pulling data from a site that spits out results in UTF-16LE format (was able to determine that by looking at the header). The data shows up fine when I do a System.out.print(data_in), BUT when I try to save it (append) to a file that already has UTF-8 data, (or any file for that matter) I get gibberish. The reason this data is in UTF-16LE is because it may contain internationalized domains which use the more flexible encoding.

Now, is there any way I can easily convert the String data (which is just US characters pretty much) to UTF-8? I don't care if the non-us characters get replace with ? (there are none anyways).

I'm really stuck here.

Thanks!
Lucy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2006
Added on Aug 15 2006
4 comments
619 views