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!

Reading UCS-2LE or UTF-16LE from file

807606May 24 2007 — edited May 24 2007
Hello,

I am writing a program to compile some simple statistics from an exported iTunes library .txt file. I have determined that when iTunes exports the file, it exports it in either the UCS-2LE or UTF-16LE encoding. I have viewed these files in a hex editor and the first 4 digits are
ff fe
.

I would like to read text from this file into my program, but I can't because it is in a weird encoding. Right now, I have to "Save as" the file to a different encoding (usually I use ASCII), to be able to read it.

This is the code I am currently using to read the input.
FileReader freader = new FileReader(file_name);
BufferedReader input_file = new BufferedReader(freader);
I am fairly new to Java so any help is appreciated, and please try to be as specific as possible.

Thanks.

Message was edited by:
imdandman
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2007
Added on May 24 2007
7 comments
1,299 views