NetBeans 6.0 implements a project encoding setting.
To change the language encoding for a project:
The encoding affects at least:
*.properties files always use ISO-8859-1 encoding plus \uXXXX} escapes. *.xml files and some *.html files can specify their own encodings, regardless of the project encoding. For such files, the IDE's editor ignores the project encoding.
Non-ASCII characters may be used in filenames relevant to a project regardless of the project's source file encoding, subject to the capabilities of your operating system. (Modern Linux installations can generally handle any Unicode character in filenames. Other operating systems generally do not handle full Unicode in filenames well, or handle only characters appropriate to the OS's region settings.) If such filenames are referred to in the bodies of source files, however, then the project encoding is relevant; for example, Klíč.java must contain class Klíč in its body, so the project encoding must handle Czech characters.
For a new IDE installation, UTF-8 encoding is the default for new projects, as this encoding can handle any Unicode characters, making it the best choice for most people. When you create a new project, the IDE initially defaults to giving it the same encoding as the last project on which you set the encoding. If you want another encoding, just change it in the properties dialog. This current default encoding is also used for older projects created in pre-6.0 IDEs, but it is best to configure the encoding explicitly for these.
If you change the encoding of a project that already has non-ASCII characters in its source files, those characters may no longer be valid, and compiling or running the project may fail; if those files are opened in the source editor, they may be displayed (and saved) incorrectly.
Older versions of NetBeans IDE use the operating system's platform encoding by default as the encoding of plain text files (e.g. Java sources, JavaScript and other files). These files cannot 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. The configurations below are known solutions.
How to set the encoding on UNIX/Linux?
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
How to set the encoding on Windows?
(not written)
Applies to: NetBeans 4.0 through 6.5