XML 中的 Unicode 字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11592013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 13:36:16  来源:igfitidea点击:

Unicode string in XML

xmlunicode

提问by Noha Nhe

In xml unicode are represented as follows:

在xml中unicode表示如下:

e.g:

例如:

\ue349 

What if I want to write a string consists of two chars with unicodes e343 e312

如果我想写一个由两个字符组成的字符串,unicodes e343 e312 怎么办

How can this be represented in XML?

这如何用 XML 表示?

回答by Jukka K. Korpela

XML does not use \ue349notation. Character references, starting with &#, may be used, but they are mostly not needed. XML is usually used with UTF-8 character encoding, so that each character can be written as such. (When generating XML in a program, you might well use a notation like \ue349if supported by the programming language.)

XML 不使用\ue349符号。可以使用以 开头的字符引用&#但通常不需要它们。XML 通常与 UTF-8 字符编码一起使用,这样每个字符都可以这样写。(在程序中生成 XML 时,您可能会使用\ue349编程语言支持的符号。)

In Unicode, the numbers E343 and E312 refer to Private Use codepoints, to which no character is assigned by the standard. They may be used by private agreements as desired, but you should not expect any software or any person to understand them, except by such agreements. With this in mind, the code points U+E343 U+E312 (and hence the characters they may denote by some agreement) can be written as .

在 Unicode 中,数字 E343 和 E312 指的是专用代码点,标准没有为其分配字符。它们可以根据需要由私人协议使用,但您不应期望任何软件或任何人理解它们,除非此类协议。考虑到这一点,代码点 U+E343 U+E312(因此它们可能通过某种协议表示的字符)可以写为.

回答by Esailija

<node>&#xE343;&#xE312;</node>

<node>&#xE343;&#xE312;</node>