Unless you specify what is the encoding of the string (either at the beginning of the string, in a <?xml version="1.0" encoding="iso-8895"?> header, or in the MemBufInputSource object, the string is treated as UTF-8, and it doesn't look it is UTF-8 at all.

Alberto

Il 03/01/2014 14:10, Vadapalli, Deepthi ha scritto:
Hi,

With Czech republic characters, XercesDOMParser's parse function is throwing an 
exception UTFDataFormatException.

My test program code snippet is:

...
xercesDOMParser* parser = new XercesDOMParser();
xercesc::MemBufInputSource* inputSource = NULL;

std::string mystr = "<test>hello íčty</test>";
try
{
inputSource = new xercesc::MemBufInputSource((const XMLByte*) mystr.c_str(),(unsigned 
int)mystr.length(), "inputsource", false);
         parser->parse(*inputSource);
}
catch (...) {
             cout << "Unexpected Exception \n" ;
             return -1;
         }
...

I am using xerces 3.1 version.

Can you please suggest what could be wrong with this program?

Thank you
Deepthi




-----
Nessun virus nel messaggio.
Controllato da AVG - www.avg.com
Versione: 2014.0.4259 / Database dei virus: 3658/6971 -  Data di rilascio: 
02/01/2014


Reply via email to