How to store special characters in xml
I save "Children's Music and videos" in xml
so i used the following code to convert special characters
string str = "Children’s Music & videos";
string temp = HttpUtility.HtmlEncode(str);
but the xml is not readable after saving the encoded value. How to store these special characters in xml
Thank,
If you have the correct text on the line to begin with, using the regular XML API should encode everything correctly for you.
I am assuming you have bad text in your lines. See my article Debugging Unicode Problems for suggestions.
I believe you need to store the special character as its numeric representation &<nnnn>;
.
See Wikipedia for details - http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
You must use a tag <![CDATA[ ]]>
to wrap the text with special characters.
Here's more on CDATA .