souri datta wrote:
Hi,
In the external function whenever I am getting an argument which has
some Unicode chars in it,when i try to convert it to std::string..it is
causing transcode(..) method carshes.
All of the characters in a XalanDOMString are "Unicode characters." Do
you mean non-ASCII characters?
For example
suppose in the external function args[0]->str() contains some Unicode chars.
so when I do (args[0]->str()).transcode(opVector); // opVector is of
type CharVectorType;
it is crashing.
It's probably not crashing. It may be throwing an exception because
you're trying to transcode to a local code page that cannot represent
all of the characters in the string.
You might want to try surrounding the transcoding block with a try/catch
handler:
try
{
args[0]->str().transcode(opVector);
}
catch(const XalanDOMString::TranscodingError&)
{
std::cerr << "Transcoding failed!\n";
}
In general, it's a bad idea to transcode to the local code page, since
it may not be able to encode all of the characters in the XalanDOMString.
Dave