• 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
Re: Unicode strings in ppc and intel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode strings in ppc and intel


  • Subject: Re: Unicode strings in ppc and intel
  • From: Chris Suter <email@hidden>
  • Date: Mon, 26 Jun 2006 12:34:11 +1000


On 26/06/2006, at 12:19 PM, Julio Cesar Silva dos Santos wrote:

Hi,

I am facing a strange problem with an app that I am developing. It retrieves information from iTunes (song name, artist, etc.) and all my tests were successful (I am using a ppc based mac). But some users have reported strange chinese characters showing up even when iTunes displays latin characters. Reviewing the code I am using to retrieve the strings from iTunes it works this way: an NSString is created using initWithBytes method, an Unichar variable as the parameter and NSUnicodeStringEncoding as the encoding.
The users that are complaining use intel-based macs so I think this is a big-endian/little-endian problem. How can I handle this situation? Checking for __BIG_ENDIAN__ and __LITTLE_ENDIAN__ ? I searched the list archives but did not find any useful informartion so any help would be appreciated.


Thanks,

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

UTF-16 can be encoded big endian or little endian. In the absence of a byte order mark (BOM) NSString will assume it's big endian so I'm guessing that on Intel machines it's little endian and it's not finding the BOM. On 10.4 you can explicitly specify whether it's big- endian or little-endian.


Have a read of Universal Binary Programming Guidelines, Byte-Swapping Strategies section, Unicode Text Files.

- Chris



_______________________________________________
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


References: 
 >Unicode strings in ppc and intel (From: Julio Cesar Silva dos Santos <email@hidden>)

  • Prev by Date: Re: Advisory Locks on files
  • Next by Date: Re: how do I determine if this is the first time the app is launched?
  • Previous by thread: Unicode strings in ppc and intel
  • Next by thread: Not Enabled != Gray ?
  • Index(es):
    • Date
    • Thread