MATLAB: Does “xmlwrite” escape “é” as “&#xE9”

ampersandcharacterMATLABspecialunicodexmlxmlread

When writing an XML file containing numerical representation of special characters, the ampersand (&) is modified to "&".
For instance, the French accented character "é" can be represented by the numerical representation "&#xE9". However, "xmlwrite" modifies the ampersand to "&".<https://www.w3.org/TR/xml/#syntax>

Best Answer

Please note that, as far as having "&" characters in an XML file, this is technically not supported according to the XML Specification, and a standards-compliant XML encoder should always escape "&" characters. Please refer to the following snippet from the XML Specification (<https://www.w3.org/TR/xml/#syntax>):
"The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings " & " and " < " respectively."
If you want to code the representation of some special characters, you can use the Unicode representation for it and use the "native2unicode" function.