如何在 Netbeans 中打开 UTF-8 格式的文件;不扭曲字符?
How to open file in UTF-8 format in Netbeans; without distorting characters?
属性文件中有挪威语字符。
当我在启用 UTF-8 的 Notepad++ 中打开时,它正确显示:
Foreslåtte
但是当我在 Netbeans 编辑器中打开同一个文件时;它显示扭曲的字符,例如:
Foreslåtte
正在使用的 Netbeans 版本:8.0.2。
项目类型:Maven 项目
在 Maven Proeject 属性中有针对 UTF-8 的设置:
<properties>
<app.navn>posten</app.navn>
<jdk.version>1.8</jdk.version>
<wro4j.version>1.7.6</wro4j.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <--
<servlet.version>3.1.0</servlet.version>
</properties>
谁能帮忙找出需要在 Netbeans 中进行哪些设置才能获得正确的 UTF-8 字符?
右键单击属性文件 -> 属性 -> 编码 -> 勾选使用项目编码
现在打开文件,问题就解决了。
注意:我的项目编码已经设置为UTF-8。您可以设置我:右键单击项目 -> 属性 -> 来源 -> Select 编码 UTF-8
如果打开 netbeans 文件夹,编辑 netbeans.conf(它在 etc 文件夹内),您可能需要先用管理员权限打开编辑器
将 -J-Dfile.encoding=UTF-8
添加到 netbeans_default_options.
重新启动 netbeans,它现在可以正确打开它们了。
Before Java 9, the encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-ASCII characters must be entered by using Unicode escape characters, e.g. \uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set.
属性文件中有挪威语字符。 当我在启用 UTF-8 的 Notepad++ 中打开时,它正确显示:
Foreslåtte
但是当我在 Netbeans 编辑器中打开同一个文件时;它显示扭曲的字符,例如:
Foreslåtte
正在使用的 Netbeans 版本:8.0.2。
项目类型:Maven 项目
在 Maven Proeject 属性中有针对 UTF-8 的设置:
<properties>
<app.navn>posten</app.navn>
<jdk.version>1.8</jdk.version>
<wro4j.version>1.7.6</wro4j.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <--
<servlet.version>3.1.0</servlet.version>
</properties>
谁能帮忙找出需要在 Netbeans 中进行哪些设置才能获得正确的 UTF-8 字符?
右键单击属性文件 -> 属性 -> 编码 -> 勾选使用项目编码
现在打开文件,问题就解决了。
注意:我的项目编码已经设置为UTF-8。您可以设置我:右键单击项目 -> 属性 -> 来源 -> Select 编码 UTF-8
如果打开 netbeans 文件夹,编辑 netbeans.conf(它在 etc 文件夹内),您可能需要先用管理员权限打开编辑器
将 -J-Dfile.encoding=UTF-8
添加到 netbeans_default_options.
重新启动 netbeans,它现在可以正确打开它们了。
Before Java 9, the encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-ASCII characters must be entered by using Unicode escape characters, e.g. \uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set.