Re: NSString -> char* ? Use -[NSString UTF8String].
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.