Message:

   The following issue has been resolved as INCOMPLETE.

   Resolver: Alberto Massari
       Date: Thu, 23 Sep 2004 5:24 AM

Given your setup, you should not use XMLString::transcode. It is an easy API, but it 
works only if you know that the data you are transcoding is in the same locale that 
your machine is currently using.
So it's safe to use it on data that the user just entered in an edit box or from 
stdin; in your case, you have two options:
1) as you are on Windows, you can enter the string in the source file as Unicode, e.g.

XMLCh *xmlValue = L"<?xml version=\"1.0\" ...";

2) you transcode the char* string using the Latin-1 transcoder

XMLWin1252Transcoder xCode(XMLUni::fgWin1252EncodingString, 4096);

unsigned int s1Len=strlen(s1);
XMLCh unicodeString[s1Len+1];
unsigned int unicodeStrLen=s1Len;
unsigned int bytesEaten=0;
unsigned char charSizes[s1Len];
xCode.transcodeFrom((const 
XMLByte*)s1,s1Len,unicodeString,unicodeStrLen,bytesEaten,charSizes);

Hope this helps,
Alberto
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESC-1275

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESC-1275
    Summary: How to work with Polish characters
       Type: Wish

     Status: Resolved
   Priority: Major
 Resolution: INCOMPLETE

    Project: Xerces-C++
 Components: 
             DOM
   Versions:
             2.5.0

   Assignee: 
   Reporter: G S

    Created: Wed, 22 Sep 2004 3:25 AM
    Updated: Thu, 23 Sep 2004 5:24 AM
Environment: Windows 2000, Visual C++

Description:

I have a string which contains Polish characters but when I tried to get a Document 
Element, a NULL is returned.
However without Polish characters I get a vaild pointers. 
I have UTF-8 as the encoding but still it does not work.

I would like to know how to get a valid Document Element pointer if my string contains 
Polish or for that matter any language characters.

Any input to solve this would be great.

I have attachment the code-snippet below:

//unsigned char s1[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" 
?><abc><xyz>Hello</xyz><klm>We will rock u</klm><polish>a &#261; b c &#263; d e &#281; 
f g h i j k l &#322; m n &#324; o ó p r s &#347; t u w y z &#378; 
&#380;</polish></abc>";
                unsigned char s1[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" 
standalone=\"no\" ?><abc><xyz>Hello</xyz><klm>We will rock 
u</klm><polish>xxxxx</polish></abc>";

              XMLCh xmlchEncodingMode[100];
              XMLString::transcode("UTF-8", xmlchEncodingMode, 99);

              XMLCh *xmlValue ;
                    xmlValue = XMLString::transcode((char*)s1);
                    XMLString::trim(xmlValue);
              

              MemBufInputSource  *pInputSource = new MemBufInputSource(s1, 
strlen((char*)s1),(char*)0);

              pInputSource->setSystemId(xmlValue);

              pInputSource->setEncoding(xmlchEncodingMode);

              Wrapper4InputSource InputSourceWrapper(pInputSource);
              doc = parser->parse(InputSourceWrapper);

              DOMElement *pNode = doc->getDocumentElement();


Thanx 
GS


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to