Hi,
I have a service that is using xerces-c and has to be run stared under C
locale for LANG and LC_*. I need xerces to be able to parse xml with UTF-8
characters, so I used this workaround:

setlocale(LC_CTYPE,"en_US.UTF-8");
XMLPlatformUtils::Initialize();

And while it seems to work, I noticed that Initialize constructor has a
parameter “const char *const locale”, which I assume [1] overrides any
system variables. However,

XMLPlatformUtils::Initialize("en_US.UTF-8");

this code compiles, but still throws exceptions when it encounters UTF-8
characters.

Am I correct to assume that parameter “locale” in constructor “Initialize”
overrides LC_CTYPE, LC_ALL and LANG variables when choosing how to
interpret characters? Or is there a bug in the constructor or is the
“locale” parameter written wrong?

Is my current work around a "good practice"?

[1] http://xerces.apache.org/xerces-c/apiDocs-3/classXMLPlatformUtils.html

Reply via email to