NOTE - the information below applies to NetBeans 5.X and earlier releases; for NetBeans 6.0, there is now a project encoding property and addtional functionality for file encoding handling; a separate faq item will be written for this; also see NetBeans 6.0 on line help.
NetBeans IDE uses OS platform encoding by default as the encoding of plain text file (e.g. Java source, JavaScript and other files). These files can not contain any encoding information, so the IDE uses the default encoding of the operating system for them. For example, when you use the Japanese localization of Windows, the encoding of Java files will be Shift_JIS by default.
JSP, HTML and XML files can contain encoding information defined by a tag. You can put such information into the files, e.g. as a meta tag in HTML files.
There is no perfect solution for NetBeans 5.x right now. The configurations below are known solutions.
If you use the UNIX/Linux platform, you can start the IDE with the UTF-8 locale. Most modern UNIX/Linux platforms support UTF-8 locales. For example, if you use Japanese,
% export LANG=ja_JP.UTF-8 % netbeans
There is no way in Windows to change the locale at IDE startup. This means for example, that the IDE always uses Shift_JIS on Japanese Windows. When you want to use UTF-8 encoding in Java sources file, you need to change the encoding of the source editor, and add a compiler option. Please follow the steps below.
This is the setting just for the Editor. Now you need to set compiler options:
Currently, there is no recommended solution. Some people use the "-J-Dfile.encoding=UTF-8" switch as IDE startup option, but it's not a perfect solution.
Platforms: All