tinyxml2
tinyxml2 copied to clipboard
Unable to encode not printable char
I am unable to encode not printable ASCII.
Using Visual Studio 2015 I am running following code
XMLDocument doc;
XMLDeclaration* decl = doc.NewDeclaration("xml version = \"1.0\" encoding = \"UTF-8\" ");
doc.LinkEndChild(decl);
pValue = doc.NewElement("Value");
pValue->SetText(" I am not printable ASCII: \x02 \x7f");
Expected result: <Value>I am not printable ASCII:   </Value>
Observed result Non printable ASCCI are not encoded into std xml
NOTE: The decoding work fine, if into xml file this string is founded �d it is correctly converted into [CR] ASCII
I have tried also to set version 1.1 but it still does not encode.
XMLDeclaration* decl = doc.NewDeclaration("xml version = \"1.1\" encoding = \"UTF-8\" ");