How to detect string coding in cocoa?

How to detect string coding in cocoa? Recently, I am working on a radio player. Sometimes the id3 tag text is garbled.

Here is my code:

CFDictionaryRef audioInfoDictionary;
UInt32 size = sizeof(audioInfoDictionary);
result = AudioFileGetProperty(fileID, kAudioFilePropertyInfoDictionary, &size, &audioInfoDictionary);

ID3 information is in audioInfoDictionary. Sometimes id3 does not use utf8 encoding, and the name and artist name are distorted.

Is there a way to determine which encoding to use a string?

Special thanks!

+3
source share
1 answer

While this is an NSString object, there is no special encoding, since it is guaranteed to represent everything that fits into it, using the encoding defined when it was created. See the section "Work with encodings" of documents.

ID3? , , . . ( URL) . , ( ) " ", . "usedEncoding:" .

, . (MP3) - (-)? , , , , .

+3

All Articles