来自Windows和Mac OS X的速度的输出中的不同编码

发布于 2025-01-26 03:19:10 字数 377 浏览 1 评论 0原文

全部,

我再次发现自己处于混乱的黑洞中,这是编码的话题。

我有一个Java应用程序,该应用程序以CSV文件的形式给出输入,使用速度创建XML文件。我已经介绍了代码,据我所知,我设置并使用了应有的所有地方的适当编码(UTF-8)。当我在自己的笔记本电脑(MAC OS X)上运行此工具时,所有内容都按预期工作,并且输入中的任何特殊字符都正确写入XML文件。当我在运行Windows作为OS的VMware机上运行它时,也是如此。但是,当该工具在其他几台机器上运行时,这些特殊字符被显示为某种类型的编码值(而不是XML使用的良好编码)。

操作系统/机器本身可以影响Java以这种方式编写/读取文本时的行为吗?如果是这样,我需要在代码中做什么才能覆盖这种行为,以使我充满信心?

问候, 丹尼尔

All,

once again I find myself in the black hole of confusion that is the topic of encodings.

I have a Java application that given input in the form of a CSV file creates XML files using Velocity. I have gone over the code and as far as I can see I set and use the proper encoding (UTF-8) in all places where I'm supposed to do so. When I run this tool on my own laptop (Mac OS X) everything works as expected and any special characters from the input is written correctly to the XML file. This is also true when I run it on a VMware machine running Windows as its OS. However, when the tool is run on a couple of other machines these special characters are shown as some type of encoded value (and not the good encoding used for XML).

Can the OS/machine itself affect how Java behaves when writing/reading text in this manner? If so, what do I need to do in my code to override this behaviour so that I can be confident?

Regards,
Daniel

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文