There are possibly three things going wrong. The first is that you're not telling System.out what encoding you want to use to print. It doesn't matter if you've correctly stored the characters in a String, the output system still needs to know what encoding you want to print the data in.
The second problem is that even if your program prints in the encoding you want, the program that's receiving the data (probably the command prompt, or maybe your IDE console) may not expect this encoding, and interpret the data incorrectly.
The third problem is that even if the console understands exactly what character you want to print, its font does not have a graphical glyph to represent the character, and displays it with a surrogate instead.
I recommend you write a small GUI with a text area, that uses the MS Gothic font. Now try to append different characters to it.
Sajin Balakrishnan
Greenhorn
Joined: Feb 21, 2012
Posts: 11
posted
0
actually the problem in converting xml to excel.greek letters are stored in database which when read from database and exported in excel using below method.appears as ??? in excel
This is part of why your program doesn't work as intended. You should not mess around with the raw bytes. Instead, there are some great classes in the standard library that will make life easier for you.
Try using the following:
Now you will be able to simply write the String you want to the Writer, and it will encode it to the correct character set.