Re: Displaying Unicode
Re: Displaying Unicode
- Subject: Re: Displaying Unicode
- From: Ali Ozer <email@hidden>
- Date: Thu, 29 Nov 2001 00:54:40 -0800
>
returnString = [NSString stringWithString: (NSString *)
>
uniString]; // works-- but not without the cast... why?
You don't need this step, as CFStrings and NSStrings are toll-free
bridged, meaning they are equivalent. (A cast is all you need.)
>
CFDataRef stringData = CFDataCreateWithBytesNoCopy(NULL, (const
>
UInt8 *) parsePtr, stringLength, kCFAllocatorNull);
>
uniString = CFStringCreateFromExternalRepresentation(NULL,
>
stringData, kCFStringEncodingUnicode);
>
CFRelease(stringData);
These other steps look fine, and assuming the original data was in UCS-2
format, should work. You should open the original data in TextEdit (or
copy/paste) and see how it shows up...
Ali