I am using Netbeans6.9.1 IDE and wants to show the Chinese characters in the output console using java.
I copied the Chinese charater from a web page and copied between the "". but its not supported.
String char1="世界你好"; System.out.println(char1);
Do I need to do some setting in IDE or use some settings in my Java code?
You have to see the character encoding used by your console. Mine works fine though. Another thing to check is the character encoding used by the class file u r implementing.
Project Properties | Sources | Encoding
Set it to UTF8
Edit the file
netbeans.conf
from theetc
directory located at the installation directory of NetBeans. In thenetbeans_default_options
option, add-J-Dfile.encoding=UTF-8
.Works for both console input and output in NetBeans.
You can check this resource for help on setting character encoding
FaqI18nProjectEncoding
Can you try this instead:
The escape sequences get resolved by the javac compiler to the corresponding unicode codepoints, this way you are independent of the actual source code encoding. Any remaining display problems should then be caused by the console or an incomplete font.
PS: In my Netbeans installation (7.0 M2 on Ubuntu Linux) both strings mostly work except for the third character, which gets displayed as a box.