• 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: NSString -> char* ? Use -[NSString UTF8String].
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString -> char* ? Use -[NSString UTF8String].


  • Subject: Re: NSString -> char* ? Use -[NSString UTF8String].
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 25 Aug 2003 12:25:59 -0500

On Monday, August 25, 2003, at 11:56 AM, Chris Garaffa wrote:
I'd check out the following NSString methods:
- cString:
- lossyCString:
- getCString: (and variants)

I *wouldn't* check out the above methods; they're deprecated.

- UTF8String:

This is what I would use.

Please, don't use -[NSString cString]. You're making your code unnecessarily fragile when you do so because of the way it determines which encoding to use for the returned string. -[NSString UTF8String] will always return the same encoding no matter what the user's language preferences are set to.

-- 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.

  • Follow-Ups:
    • Re: NSString -> char* ? Use -[NSString UTF8String].
      • From: Pei Xiang <email@hidden>
References: 
 >Re: NSString -> char* ? (From: Chris Garaffa <email@hidden>)

  • Prev by Date: Re: Apple Help Interface Guidelines
  • Next by Date: Re: Arabic in Cocoa. Any Experiences (also Panther)?
  • Previous by thread: Re: NSString -> char* ?
  • Next by thread: Re: NSString -> char* ? Use -[NSString UTF8String].
  • Index(es):
    • Date
    • Thread