wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes Reading Japanese Characters from Text 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 "Reading Japanese Characters from Text File" Watch "Reading Japanese Characters from Text File" New topic

Reading Japanese Characters from Text File

Souvik Das

Joined: Oct 11, 2007
Posts: 15
I have a text file where the text is written in Japanese. While I want to read the file using Java it can not recognise the japanese characters and it is giving "???" like characters instead of Japanese characters.

FileInputStream fis = new FileInputStream("out.txt");
InputStreamReader isr = new InputStreamReader(fis,"UTF-8");

Reader in = new BufferedReader(isr);

StringBuffer buf = new StringBuffer();
int ch;
while ((ch = in.read()) > -1) {

String message = new String(buf.toString()); // Here i want the japanese characters to appear

I have also tried "Shift_Jis" encoding isnstead of "UTF-8" encoding also.

Thanks in advance.
subject: Reading Japanese Characters from Text File
Similar Threads
How can I get Unicode String of a String?
Problem while Reading Japanese Characters from a Text File
readUTF not working
file, UTF8
Setting strings explicitly and using JOptionPane - UTF Character conversion problems...