xml:日语编码

发布于 2024-12-10 02:18:43 字数 308 浏览 0 评论 0原文

我正在制作一个包含日语字符串的 xml 文档。我尝试过不同的编码,但每次保存文件时,它都会用“??????”替换日文字符串。我这里有一个非常简短的示例代码。请告诉我应该使用什么编码xml 文档。

<?xml version="1.0" encoding="utf-8"?>
<config>
        <start_text>転送</start_text>
</config>

请告诉我应该使用什么编码,以便即使在保存并关闭 xml 文档后仍保留日语字符。 谢谢大家

I am making an xml document with japanese strings in it. I have tried different encodings but everytime when I save the file, it replaces the japanese strings with "??????".. I have a very brief sample code here.. Please advise me towards what encoding should I use for the xml doc.

<?xml version="1.0" encoding="utf-8"?>
<config>
        <start_text>転送</start_text>
</config>

Please advise me regarding what encoding should I use so that the japanese characters are retained even after saving and closing the xml doc.
Thanks all

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

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

发布评论

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

评论(1

江挽川 2024-12-17 02:18:43

您的 XML 文件中有两个日语字符,您会看到六个问号。正如您在 XML 文件中提到的,这听起来像 UTF-8 编码。有几种可能性:

读取 XML 文件的程序使用 ASCII 编码来读取它,因此用问号替换 ASCII 范围之外的每个字节。

该程序正确读取 XML 文件,但随后使用 ASCII 编码将 UTF-8 编码的字节打印到某个输出通道,并用问号替换每个超出范围的字节。

(旁注:如果输出是 è»entié?? ,它将以 UTF-8 格式打印到 ISO-8859-1 输出通道。但它似乎是六个问号。)

您需要找出发生以下转换的位置:

  • 字节序列转换为字符序列。 (可能在 XML 阅读器中。)
  • 字符序列转换为字节序列。
  • 字节(或字符)序列被转换为字形序列。 (用于显示它们;这可能是编辑器或控制台。)

There are two Japanese characters in your XML file, and you get six question marks. This smells like UTF-8 encoding, as mentioned in your XML file. There are several possibilities:

The program that reads the XML file reads it with encoding ASCII, and therefore replaces every byte outside the ASCII range with a question mark.

The program reads the XML file properly, but then prints the UTF-8 encoded bytes to some output channel using the ASCII encoding, replacing each out-of-range byte with a question mark.

(Side note: If the output were 転é?? it would be UTF-8 printed to an ISO-8859-1 output channel. But it seems to be six question marks.)

You need to find out at which places the following transformations happen:

  • A byte sequence is transformed to a character sequence. (Probably in the XML reader.)
  • A character sequence is transformed to a byte sequence.
  • A byte (or character) sequence is transformed into a glyph sequence. (For displaying them; this may be an editor or a console.)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文