From: George R. <gr...@us...> - 2003-04-30 18:15:55
|
Please use this line instead (remove the reference from status). int32_t len = ustr.extract( pCharBuffer, ustr.length() * 2 + 1, conv, status); George Rhoten IBM Globalization Center of Competency/ICU San Jose, CA, USA Yan Li <ya...@es...> Sent by: icu...@ww... 04/29/2003 08:49 PM To: "'sr...@jt...'" <sr...@jt...> cc: George Rhoten/San Jose/IBM@IBMUS, "'icu...@os...'" <icu...@ww...> Subject: RE: Problem converting the Unicode character (U2225) to SJIS Now I have a new problem. I got the following compile error while I was trying to use int32_t UnicodeString::extract(char *dest, int32_t destCapacity, UConverter *cnv, UErrorCode &errorCode) const; H:\ICU\others\test\test.cpp(24) : error C2664: 'void __thiscall icu_2_2::UnicodeString::extract(long,long,unsigned short *,long) const' : cannot convert parameter 1 from 'char *' to 'long' This conversion requires a reinterpret_cast, a C-style cast or function-style cast Error executing cl.exe. What did I do wrong? Here is my testing code: #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]; UConverter* conv; UErrorCode status=U_ZERO_ERROR; conv = ucnv_open("ibm-943_P14A-2000", &status); ucnv_setFallback(conv, TRUE); int32_t len = ustr.extract( pCharBuffer, ustr.length() * 2 + 1, conv, &status ); //line 24 where the error is. len=ucnv_fromUChars(conv, pCharBuffer, ustr.length() * 3 + 1, &ch, 1, &status); ucnv_close(conv); delete[] pCharBuffer; return 0; } ------------------------------------------------- Yan Li ESRI Tel: (909) 793-2853 Ext. 2063 -------------------------------------------------- -----Original Message----- From: sr...@jt... [mailto:sr...@jt...] Sent: Tuesday, April 29, 2003 7:10 PM To: Yan Li Cc: 'George Rhoten'; 'icu...@os...' Subject: Re: Problem converting the Unicode character (U2225) to SJIS You could also keep the converter around instead of closing it. Extract would open and close a new one which is actually (slightly) more expensive. hope this helps. -s On Tuesday, April 29, 2003, at 05:49 PM, Yan Li wrote: > In that case I have to use ucnv_open() before the > UnicodeString::extract() > and ucnv_close() after it. It's kind of a little tedious. Is this the > only > way that I can make the converter working with fallbacks for > UnicodeString? _______________________________________________ icu...@os... - icu4c-support mailing list To Un/Subscribe: http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu4c-support |