You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Alberto Massari <am...@datadirect.com> on 2005/07/20 09:22:40 UTC
RE: Does using setlocale to set other codepage will effect the
transcoder made by the
XMLPlatformUtils::fgTransService->makeNewLCPTranscoder()
Hi Gurminder,
you are right in using XMLString::transcode instead of
DOMString::transcode, as they do the same thing: converting a Unicode
string into the local code page (i.e. the new code should translate
everything that the old code was translating).
>[...]
>string XMLDomParser::GetValueOfNode(const DOM_Node& theNode)
>{
> string myNodeValue;
> char* NodeValue ;
> DOM_Node myIdChildNode = theNode->getFirstChild();
> if(myIdChildNode != NULL)
> {
> NodeValue =
>XMLString::transcode(myIdChildNode->getNodeValue());
>
> }
> myNodeValue = NodeValue;
> delete NodeValue;
> return myNodeValue;
>
>}
Be careful here: if myIdChildNode is missing you are deleting a
pointer that has not been initialized, leading to possible crashes.
Also, why do you still use DOM_Node but not DOMString?
>But the XMLString::trancode is not able to parse the string in Japanese
>language. If I am wrong how should I do?
Can you also say what you mean by "not able to parse", also by giving
us an example?
Alberto
>--Regards
>--Gurminder singh.
>
>-----Original Message-----
>From: Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Tuesday, July 19, 2005 10:40 PM
>To: c-users@xerces.apache.org
>Subject: Re: Does using setlocale to set other codepage will effect the
>transcoder made by the
>XMLPlatformUtils::fgTransService->makeNewLCPTranscoder()
>
>Hi Gurminder,
>can you explain us why you are "parsing strings through
>XMLString::transcode"? A snippet of code would help too.
>
>Thanks,
>Alberto
>
>At 21.49 19/07/2005 +0530, Gurminder Singh wrote:
> >Hi community,
> >
> >
> >
> >I am try to parse an UTF-8 encoded xml document containing some
>japanese
> >strings. When i parse the Japanese strings through XMLString::trancode
> >which by default uses the XMLLCPTranscoder which finally make the
> >Win32LCPTranscoder which is not able to parse the strings correctly and
> >give garbage characters.
> >
> >Then i tried using ICU transervice by defining "XML_USE_ICU_TRANSCODER"
> >still the trascoder made is on the basis of codepage returned by the
> >call GetACP() ; my question is if i use the setlocale to change the
> >codepage to japanese from 1252 (default on XP) will it effect the
> >transcoder returned.
> >
> >
> >
> >Another one is can i transcode to/from something besides the local code
> >page using XMLString::transcode
> >
> >
> >
> >Any help is appreciated.
> >
> >
> >
> >--Regards
> >
> >--Gurminder singh.
> >
> >
> >
> >
> >
> >--Regards
> >
> >--Gurminder singh.
> >
> >