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?
On project explorer, right click on the project, Properties -> General -> Encoding. This will allow you to choose the encoding per project. I don't know about former versions of NetBeans, but currently (NetBeans IDE 8.1) this is the right solution for me.
UTF-8 is a variable width character encoding. UTF-8 has the ability to be as condensed as ASCII but can also contain any Unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies that it allocates 8-bit blocks to denote a character.
Yes. 0xC0, 0xC1, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF are invalid UTF-8 code units.
The netbeans. conf file is located at Contents/Resources. NetBeans/etc/netbeans. conf within the package contents.
Edit the file netbeans.conf
from the etc
directory located at the installation directory of NetBeans.
In the netbeans_default_options
option, add -J-Dfile.encoding=UTF-8
.
Works for both console input and output in NetBeans.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With