Reputation: 101
How to encode special characters in xml? e.g: i have a special character mu in my xml, transformation will fail due to this character any info would be helpful
Thanks Preetham
Upvotes: 1
Views: 8314
Reputation: 24291
If you are building up your XML via string concatenation then you need to stop doing that and start using a library (e.g. DOM) in your language to create the XML.
The library will handle encoding correctly.
Upvotes: 11
Reputation: 527
This is sometimes referred to as "escaping", see here for example.
Upvotes: 0
Reputation: 31071
XML text defaults to the UTF-8 encoding. This supports all characters you care to throw at it. Only by deliberately selecting a non-international encoding would it fail to encode correctly.
Upvotes: 0
Reputation: 403501
Any valid UTF-8 character should be fine in XML, and any XML processing tool (including XSLT) should handle them also. If the file is valid XML, then it should work. Can you post an example XML file that is giving you trouble?
Upvotes: 1
Reputation: 5608
you can encode your xml in utf-8 and use
<node><![CDATA[ odd characters here ]]></node>
Upvotes: 0