Displaying Unicode
Displaying Unicode
- Subject: Displaying Unicode
- From: Bill Bumgarner <email@hidden>
- Date: Thu, 29 Nov 2001 02:07:41 -0500
I'm trying to display the unicode-- (ISO/IEC 10646-1:1993, UCS-2) as per
the spec-- as read from the ID3 tags found in an MP3 file and am having
some difficulty.
In detail:
- copy/paste a Japanese sequence of characters into an ID3 tag in
iTunes
- run my app [Podestal] and attempt to display the characters
Currently, the app IS displaying a sequence of characters, but they are
not even of the same character set as the original string (I'm not even
going to pretend that I have the remotest clue as to the names of the
character sets or what the actual test string contains.)
The code effectively looks like this:
CFDataRef stringData = CFDataCreateWithBytesNoCopy(NULL, (const
UInt8 *) parsePtr, stringLength, kCFAllocatorNull);
uniString = CFStringCreateFromExternalRepresentation(NULL,
stringData, kCFStringEncodingUnicode);
CFRelease(stringData);
returnString = [NSString stringWithString: (NSString *)
uniString]; // works-- but not without the cast... why?
CFRelease(uniString);
The resulting unicode string is displayed in a cell of an
NSTableView/NSOutlineView.
Any clues/pointers would be most appreciated-- I'm totally stumped.
(Also-- I don't pretend to know if I'm exercising the CF APIs correctly in
even this simple of a usage.... if not, laugh all you want, just make sure
you are pointing to the problem while laughing. :-)
thanks,
b.bum