Here is the output from the method Number of chars = 3 Looking in pValue pValue=72 pValue=105 pValue=-51 Breaking out of loop 1 Required size of wchar = 3 Number of converted bytes = 3 wide character: HiÍ
Looking in pwcValue pwcValue=72pwcValue=105pwcValue=205pwcValue=64768pwcValue=65021pwcValue=253Brea ing out of loop 2 Done The values for Hi(72 and 105) are correct, not sure what the rest of the values are cause the decimal value for 65e5 is 26085 -----Original Message----- From: Fred Grafe Sent: Friday, June 06, 2003 10:38 AM To: [EMAIL PROTECTED] Subject: Xerces and Domino DSAPI : Internation characters, Unicode and UTF-8 issue Importance: High Hi there, I am sending XML data that contains international characters to a domino server(on win 2k) using the http server and DSAPI. For example, following example would contain the japanese character (say 0x65E5) My XML data would look something like this <?xml version="1.0" encoding="utf-8"?> <method name="somMethodName"> <prop name="0Firstname type="string"> Hi? </prop> </method> (the question mark is just a place holder for the japanese character) I need to extract the prop value and place it in a WCHAR becuase the method I'm calling is expecting wide characters. Do I need to do any conversions from XMLCh to WCHAR. I figure I would use the XMLString::Transcode method, then call mbcstows method to convert to wchar I've read in the some post that XMLCh has the same type def as. Below is my characters method from my SAX2 handler void DsapiSax2Handler::characters ( const XMLCh* const pChars, const unsigned int uiLength ) { switch (m_uiParserState) { case STATE_EXPECT_METHOD: { printf("Expect method"); } break; // STATE_EXPECT_METHOD case STATE_EXPECT_PROP: { char* pValue = XMLString::transcode(pChars); printf("Looking in pValue\n"); int i = 0; while (true) { if (pValue[i] == 0) { printf("Breaking out of loop 1\n"); break; } int ch = pValue[i]; printf("pValue=%d\n", ch); i++; } unsigned int uiReqSize = 0; unsigned int uiConvertedBytes = 0; uiReqSize = mbstowcs(0, pValue, MB_CUR_MAX); printf("Required size of wchar = %d\n", uiReqSize); WCHAR* pwcValue = (WCHAR*) malloc((sizeof(WCHAR) * uiReqSize) + 1); memset(pwcValue, '\0', (sizeof(WCHAR) * uiReqSize) + 1); uiConvertedBytes = mbstowcs(pwcValue, pValue, uiReqSize); printf("Number of converted bytes = %d\n", uiConvertedBytes); printf("wide character: %lS\n\n", pwcValue); printf("Looking in pwcValue\n"); i = 0; while (true) { if (pwcValue[i] == 0) { printf("Breaking out of loop 2\n"); break; } int ch = pwcValue[i]; printf("pwcValue=%d", ch); i++; } printf("Done\n"); free(pwcValue); XMLString::release(&pValue); } break; // STATE_EXPECT_PROP default: break; } } thanks fred --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]