org.springframework.oxm.jaxb.Jaxb2Marshaller 元音变音和特殊字符

发布于 2024-09-19 16:37:47 字数 177 浏览 0 评论 0原文

如何使用以下方式编组包含变音符号的 java 字符串对象 org.springframework.oxm.jaxb.Jaxb2Marshaller ? 我有像 Alizée 这样的 java 字符串。 使用 Jaxb2Marshaller 编组后,我得到 Alizée xml 字符串。

How can I marshal java string object that contain umlauts by using
org.springframework.oxm.jaxb.Jaxb2Marshaller ?
I have java string like Alizée.
After marshalling with using Jaxb2Marshaller i get Alizée xml string.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

很快妥协 2024-09-26 16:37:47

这可能是正确的,但您正在使用错误的字符集对编组的 XML 进行编码(您将 UTF-8 视为 ISO-8859-1/扩展 ASCII)。

我会仔细检查字符编码,并确保您正在使用正确的编码查看编组的 XML。

示例: é 采用 UTF-8 格式,由两个字节表示: 0xC3 0xA9 http://www.fileformat.info/info/unicode/char/00e9/index.htm

这两个字节,表示为例如 ISO-8859-1 将读取:

如果创建文本文件包含 é 并将其保存为 UTF-8。重新打开文件,但选择编码 ISO-8859-1,您将看到相同的内容。

This can be right, but you are vieving the marshalled XML with the wrong charset (you view UTF-8 as ISO-8859-1/extended ASCII).

I would double-check character encodings and that you are viewing the marshalled XML with the correct encoding.

Example: é is in UTF-8 represented by two bytes: 0xC3 0xA9 http://www.fileformat.info/info/unicode/char/00e9/index.htm

These two bytes, represented in for example ISO-8859-1 will read:

If you create a text file containing é and save it as UTF-8. Re-open the file but choose encoding ISO-8859-1 and you will see the same.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文