• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
From Big Endian to Little Endian
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: From Big Endian to Little Endian
      • From: "Adam R. Maxwell" <email@hidden>
  • Prev by Date: Re: What exactly happens when I use Core Data's 'Remove' button?
  • Next by Date: (no subject)
  • Previous by thread: NSTextField returning null when it should not
  • Next by thread: Re: From Big Endian to Little Endian
  • Index(es):
    • Date
    • Thread