Rad*_*mko 9 java jsp netbeans character-encoding
我有一些来自其他开发人员的jsp文件,现在需要使用它们.当我向文档中添加任何UTF-8字符并想要保存文档时,NetBeans会自动为我保存ISO-8859-1.
实际上我从NetBeans收到这条消息:
index.jsp包含在转换为ISO-8859-1字符集时可能会损坏的字符.是否要使用此字符集保存文件?(是/否)
NB没有提供任何其他选项,例如将文件保存为UTF-8(因为它应该已经写入).
我不知道如何将这些jsp文件保存在已经写入的字符集中.
并且不要告诉我,改变文件本身的内容(由于包含来自其他文件的标题等而无效)是唯一的方法......
kam*_*aci 19
首先; 不要忘记在顶部考虑这条线:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
Run Code Online (Sandbox Code Playgroud)
其次; 在NetBeans文件夹中有一个配置文件.应该有这样一条线:
netbeans_default_options="-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
Run Code Online (Sandbox Code Playgroud)
将其添加到行尾:
-J-Dfile.encoding=UTF-8
Run Code Online (Sandbox Code Playgroud)
第三:
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
Run Code Online (Sandbox Code Playgroud)
从NetBeans IDE 6.8开始,您还可以指定将在运行时使用的编码.例如,当运行应用程序的操作系统的编码与项目的编码不同时,这可能很有用.
要指定要在运行时使用的编码:
runtime.encoding = <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.
Run Code Online (Sandbox Code Playgroud)
这些可能对你有帮助.
我使用的答案来源:
Link1:http://forums.netbeans.org/topic33.html
Link2:http://wiki.netbeans.org/FaqI18nProjectEncoding
| 归档时间: |
|
| 查看次数: |
8341 次 |
| 最近记录: |