[xmlsec] Unicode Utf8 as xml content?

Martin Salo Martin.Salo at gmx.net
Wed Aug 29 08:45:10 PDT 2007


Hello Mailinglist,

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:
> func=xmlSecOpenSSLEvpDigestVerify:file=..\src\openssl\digests.c:line=229:obj=sha1:
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&#x49E5;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&#x4820; ger" within my xml file.

If I search for Unicode shortcuts for "ä" in XML, I get this shortcut &#228;
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 "ä" -> "&#x4820"?

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");
xmlAddChild(oFatherNode, oNode);

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?


Regards

Martin
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger



More information about the xmlsec mailing list