• 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: Internationalized text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Internationalized text


  • Subject: Re: Internationalized text
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 29 Sep 2003 11:08:14 -0500

NSString uses Unicode natively, so you can just store everything in NSStrings and it should come across just fine.

Since all of Cocoa including the AppKit uses NSStrings you don't have to worry about things like font/script synchronization, keeping track of style runs if you want to mix scripts, etc. Everything uses Unicode natively, so the user can just choose a Greek keyboard layout and enter Greek or Japanese or Cyrillic text and you'll get real Greek or Japanese or Cyrillic Unicode characters.

XML files, such as plist files, also use one Unicode encoding or another so the property list representation of, say, an NSDictionary of NSStrings will come across just fine too. (You can create one using the class methods in the NSPropertyListSerialization class.)

The only trickiness is that Objective-C source code is defined to be 7-bit ASCII, same as ANSI C. So you can't reliably put 8-bit characters into your application's source. If you want to do that, you should use the localization mechanism. You put the full Unicode string in a Localizable.strings file, and use the NSLocalizedString or NSLocalizedStringFromTable functions in your source code with an ASCII "key" string. (These are under Foundation>General>Functions>Bundles in Cocoa Browser.)

-- Chris

--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Mac OS X Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Internationalized text (From: Darrin Cardani <email@hidden>)

  • Prev by Date: Little question on kCFCoreFoundationVersionNumber
  • Next by Date: Re: Assembling the Text System
  • Previous by thread: Re: Internationalized text
  • Next by thread: Re: opening of an external program
  • Index(es):
    • Date
    • Thread