首先; 不要忘了首先考虑以下这一行:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
其次; 在NetBeans文件夹中,有一个配置文件。应该有这样一行:
netbeans_default_options="-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
将其添加到行的末尾:
-J-Dfile.encoding=UTF-8
第三:
NetBeans实现项目编码设置。
要更改项目的语言编码:
- 在“项目”窗口中右键单击项目节点,然后选择“属性”。
- 在“源”下,从“编码”下拉字段中选择一个编码值。
编码至少影响:
* how non-ASCII characters are displayed in the editor window when you open files* Java file compilation of sources containing non-ASCII identifiers, string literals, or comments* textual search for international characters over the project
从NetBeans IDE 6.8开始,您还可以指定将在运行时使用的编码。例如,当运行应用程序的操作系统的编码与项目的编码不同时,这很有用。
要指定在运行时使用的编码:
- 在项目的“文件”窗口中,打开nbproject> private> private.properties
- 将以下行添加到private.properties文件并保存更改:
runtime.encoding = <编码>
该编码将覆盖项目的编码设置,并在运行应用程序时使用。
一般来说,
*.properties files always use ISO-8859-1 encoding plus uXXXX escapes. (International characters will be displayed natively in the editor but stored as an escape on disk.)*.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.
这些可能对您有帮助。
我使用的答案来源:
链接1:http://forums.netbeans.org/topic33.html
链接2:http://wiki.netbeans.org/FaqI18nProjectEncoding



