[xsde-users] Error during serialization of the character 'ü'
Thomas Frenzel (TomSun)
tftomsun at streamteam.de
Tue Dec 15 05:00:20 EST 2009
Hi Boris,
i created a xml schema which describes logging data. One log entry has a message, time stamp, log level ... etc.
When i try to log a message with the character 'ü' i get an xml_schema::serializer_exception with the text "illegal UTF-8 character" and what "xml error"
The create the message string like that:
LOG_ERROR("An error occured during the call of the method '%s'.ü",lastMethodName);
the lastmethod name will be inserted in the message string using the vsprintf_s function. Afterwar When i remove the last character (the 'ü'), i don't get the exception.
Code:
messageLength = _vscprintf( messagePattern, messageArguments ) + 1; // terminating '\0'
message = new char[messageLength];
printResult = vsprintf_s( message,messageLength, messagePattern, messageArguments);
message[messageLength-1] = 0;
LogEntryData* logEntry = new LogEntryData();
logEntry->Message(message);
And this is my common serialization code:
XmlWriter writer(xmlStream);
this->m_serializer.pre (*data);
writer.write(encodingInfo,strlen(encodingInfo));
this->m_documentSerializer->serialize (writer, xml_schema::document_simpl::pretty_print);
this->m_serializer.post ();
Encoding info is the following string:
this->encodingInfo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
My Project is build with the UNICODE preprocessor command.
What i am doing wrong? Like i said, just removing the ü from the message helps. But normaly this should not be a problem in an UTF-8 world.
Thanks in advance,
Tom
More information about the xsde-users
mailing list