FROM : Julio Cesar Silva dos Santos
DATE : Fri Aug 11 21:54:41 2006
Hi, a couple of months ago I sent a message to the list explaining a
problem with strings returned from iTunes and Intel Macs. My solution
was to create a CFString using CFStringCreateWithBytes. (see http://
www.cocoabuilder.com/archive/message/cocoa/2006/6/27/166393)
Now a user that is using Panther asked me that when he tries to save
strings back to iTunes, they are saved as chinese characters. This
happened because I had to change the code to check if the program is
running on Tiger or Panther.
When using Tiger the code looks like this (value is an NSString):
len = [value lengthOfBytesUsingEncoding:NSUnicodeStringEncoding];
err = AEBuildDesc(&valueDesc, NULL, "'utxt'(@)", len, [value
cStringUsingEncoding:NSUnicodeStringEncoding]);
When using Panther I tried this:
len = [value cStringLength];
err = AEBuildDesc(&valueDesc, NULL, "'utxt'(@)", len, [value
UTF8String]);
but it did not work. My question is: Should I turn value (an
NSString) into a CFString before calling AEBuildDesc so I can swap
the bytes? I guess it is the ideal solution but I would like to hear
advices.
Any help would be appreciated,
Julio Cesar Silva dos Santos
<email_removed>
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html
DATE : Fri Aug 11 21:54:41 2006
Hi, a couple of months ago I sent a message to the list explaining a
problem with strings returned from iTunes and Intel Macs. My solution
was to create a CFString using CFStringCreateWithBytes. (see http://
www.cocoabuilder.com/archive/message/cocoa/2006/6/27/166393)
Now a user that is using Panther asked me that when he tries to save
strings back to iTunes, they are saved as chinese characters. This
happened because I had to change the code to check if the program is
running on Tiger or Panther.
When using Tiger the code looks like this (value is an NSString):
len = [value lengthOfBytesUsingEncoding:NSUnicodeStringEncoding];
err = AEBuildDesc(&valueDesc, NULL, "'utxt'(@)", len, [value
cStringUsingEncoding:NSUnicodeStringEncoding]);
When using Panther I tried this:
len = [value cStringLength];
err = AEBuildDesc(&valueDesc, NULL, "'utxt'(@)", len, [value
UTF8String]);
but it did not work. My question is: Should I turn value (an
NSString) into a CFString before calling AEBuildDesc so I can swap
the bytes? I guess it is the ideal solution but I would like to hear
advices.
Any help would be appreciated,
Julio Cesar Silva dos Santos
<email_removed>
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html
| Related mails | Author | Date |
|---|---|---|
| Julio Cesar Silva… | Aug 11, 21:54 | |
| Adam R. Maxwell | Aug 11, 22:36 |






Cocoa mail archive

