From: George R. <gr...@us...> - 2003-04-30 02:03:25
|
That |1 symbol means that it's a fallback mapping. This means that you may be losing information during the conversion process. A fallback mapping does not roundtrip. If you would like to enable fallback mappings, please use the ucnv_setFallback() function to enable fallbacks. George Rhoten IBM Globalization Center of Competency/ICU San Jose, CA, USA Yan Li <ya...@es...> Sent by: icu...@os... 04/29/2003 03:24 PM To: "'icu...@os...'" <icu...@os...> cc: Subject: Problem converting the Unicode character (U2225) to SJIS Hi, I'm trying to use ucnv_fromUChars() or UnicodeString.extract() to convert the Unicode character (U2225) to SJIS. I got 0x81A1 instead of 0x8161. I looked at the mapping table ibm-943_P14A-2000.ucm. There is a line as this: <U2225> \x81\x61 |1 I assume this maps the Unicode character U2225 to 0x8161 in SJIS (or ibm-943_P14A-2000) while converting the Unicode character to SJIS (ibm-943_P14A-2000). However I got 0x81A1 instead. Please see the testing program below. Did I do something wrong here or is it a ICU converter problem? #include <windows.h> #include <stdio.h> #include <unicode/unistr.h> #include <unicode/ustring.h> #include <unicode/ucnv.h> int main(int argc, char* argv[]) { UChar ch = 0x2225; UnicodeString ustr(ch); char* pCharBuffer = new char[ustr.length() * 2 + 1]; int32_t len = ustr.extract( 0, ustr.length(), pCharBuffer, "ibm-943_P14A-2000" ); //pCharBuffer = 0x81 0xA1 0x00 UConverter* conv; UErrorCode status=U_ZERO_ERROR; conv = ucnv_open("ibm-943_P14A-2000", &status); len=ucnv_fromUChars(conv, pCharBuffer, ustr.length() * 2 + 1, &ch, 1, &status); //pCharBuffer = 0x81 0xA1 0x00 ucnv_close(conv); delete[] pCharBuffer; return 0; } ------------------------------------------------- Yan Li ESRI Tel: (909) 793-2853 Ext. 2063 -------------------------------------------------- _______________________________________________ icu...@os... - icu4c-support mailing list To Un/Subscribe: http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu4c-support |