简体   繁体   中英

How to properly escape “discourged” XML characters?

Per the XML 1.0 standard, there is a character range which is considered "discouraged": I would like to escape these characters (such as smart quote “, dec 147, or ' (dec 146)) inside of XML attribute values using their hex encoded XML entity string.

I noticed when looking at the file in Chrome or Edge for example, it shows me the actual value, such as "]" . I have also tried "]" , but that works the same as well.

To be clear, I'm attempting to render these "discouraged" characters in an attribute, like follows:

This:

<foo bar="&#0093;">

Should be rendered/interepreted by a parser as this:

<foo bar="“">

您需要结尾的分号来终止实体引用:

<foo bar="&#0093;">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM