From Big Endian to Little Endian
From Big Endian to Little Endian
- Subject: From Big Endian to Little Endian
- From: Julio Cesar Silva dos Santos <email@hidden>
- Date: Fri, 11 Aug 2006 16:54:41 -0300
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@hidden
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden