The moose likes I/O and Streams and the fly likes Unicode CSV file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Unicode CSV file." Watch "Unicode CSV file." New topic

Unicode CSV file.

Shriram Gopalakrishnan
Ranch Hand

Joined: Feb 20, 2007
Posts: 44
I am reading a Unicode CSV file which is getting read using CSVReader reader=new CSVReader(new InputStreamReader(new FileInputStream(in),"UTF-8"),'\t');
now when I print the file contents

The output is in UTF-8 for example : C r e a t e
Now when I try to compare this with normal String str=new String("CREATE".getBytes(Charset.forName("UTF-8")),"UTF-8"); its not same or equal.

So the question is how to convert or represent a String in UTF-8 format ? str.getBytes(charset) is not doing the job for me as mentioned above.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Try utf-16 rather than utf-8.

Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
I agree. Here's the link:
subject: Unicode CSV file.
jQuery in Action, 3rd edition