ZK 文本框 - 显示错误的 UTF-8 字符
ZK Textbox - Displaying wrong UTF-8 characters
我的完整 ZK 项目是 UTF-8 编码的,并相应地声明了我的 ZUL 文件,但有些字符被完全错误地翻译了。我只使用文本框来输出,还有一些空格被替换为“”,有人知道吗?
ZUL 文件:
<?xml version="1.0" encoding="UTF-8"?>
...
<textbox height="1000px" width="98%" id="label_article_abstract"
multiline="true" />
事件:
String abstract = "injection were 3.4 ± 2.3"
...
public void onEvent(Event event) throws Exception {
selectedIndex = item.getIndex();
tb_article_abstract.setValue(abstract);
}
输入:"injection were 3.4 ± 2.3"
文本框显示:"injection were 3.4 ± 2.3"
一个原因可能是您、您的源代码 editor/file 和编译器不同意您的源代码字符编码。也许您的编辑器正在将其设为 UTF-8,但您的编译器并没有被告知。
-encoding encoding
Set the source file encoding name, such as EUC-JP and UTF-8.
If -encoding
is not specified, the platform default converter is used.
—https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html
(平台的默认字符编码永远不是您想要的——除非它正是您想要的。它因机器、用户和时间而异。UTF-8 是一个很好的选择新作品。)
尽管您提出了问题,± 周围的空格似乎是 NO-BREAK SPACE (U+00A0),这在排版上很有意义。
我的完整 ZK 项目是 UTF-8 编码的,并相应地声明了我的 ZUL 文件,但有些字符被完全错误地翻译了。我只使用文本框来输出,还有一些空格被替换为“”,有人知道吗?
ZUL 文件:
<?xml version="1.0" encoding="UTF-8"?>
...
<textbox height="1000px" width="98%" id="label_article_abstract"
multiline="true" />
事件:
String abstract = "injection were 3.4 ± 2.3"
...
public void onEvent(Event event) throws Exception {
selectedIndex = item.getIndex();
tb_article_abstract.setValue(abstract);
}
输入:"injection were 3.4 ± 2.3"
文本框显示:"injection were 3.4 ± 2.3"
一个原因可能是您、您的源代码 editor/file 和编译器不同意您的源代码字符编码。也许您的编辑器正在将其设为 UTF-8,但您的编译器并没有被告知。
-encoding encoding
Set the source file encoding name, such as EUC-JP and UTF-8.If
-encoding
is not specified, the platform default converter is used.—https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html
(平台的默认字符编码永远不是您想要的——除非它正是您想要的。它因机器、用户和时间而异。UTF-8 是一个很好的选择新作品。)
尽管您提出了问题,± 周围的空格似乎是 NO-BREAK SPACE (U+00A0),这在排版上很有意义。