Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying Unicode



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




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.