[xmlsec] Unicode Utf8 as xml content?
Martin.Salo at gmx.net
Wed Aug 29 08:45:09 PDT 2007
I'm building an application file format in XML. This format should support verifying. My parser worked right on test data, but at the first time I tried to work with real data I got this error while verifying the file:
subj=unknown:error=12:invalid data:data and digest do not match
I could locate the error on a name (Jäger) with an "ä" in it. It was written to XML as "J䧥r" <- What is this? No valid Xml, I think this is the reason why verifying (canonisation) doese not work.
If I take the name "Jä ger" I get this string "J䠠 ger" within my xml file.
If I search for Unicode shortcuts for "ä" in XML, I get this shortcut ä
If I convert x4820 to decimal I get 18464 != 228...
And in Utf-8 a "ä" should be 50084.
1. What kind of conversion is this "ä" -> "䠠"?
2. My hope is that xmlsec encupsulates iconv.dll. How can I create nodes with the XmlSec Api? I cannot find any api to set the node content.
xmlSecAddChild(oFatherNode, BAD_CAST "Name", 0);
// Example how I create a XML node at the moment (I use the libxml2 Api):
xmlNode *oNode = xmlNewDocNode(oXmlDoc, 0, BAD_CAST "Name", 0);
xmlNodeSetContent(oNode, BAD_CAST "Jäger");
Or must I use the iconv.dll Api manually to convert my not ASCII characters?
3. At this moment I convert the xmlChar I get from the parser manually to unicode (unsigned short), because I'm working within my program with std::wstring. Is there a possibilty to get directly unicode strings?
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
More information about the xmlsec