Re: NSString from Palm text?
Re: NSString from Palm text?
- Subject: Re: NSString from Palm text?
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 8 Oct 2003 21:31:32 -0700
On Wednesday, October 8, 2003, at 08:46 PM, Dave Riggle wrote:
I need to exchange text with a Palm OS device. How do I translate
between a (unicode) NSString and the following three character
encodings?
1. MS code page 1252 for EFIGS devices
NSData *windowsText = [string
dataUsingEncoding:NSWindowsCP1252StringEncoding];
2. Shift JIS encoding for Japanese devices
NSData *shiftJISText = [string
dataUsingEncoding:NSShiftJISStringEncoding];
I hate to say it, but you could have found out both of the above simply
by reading the NSString documentation...
3. GB encoding for Chinese devices
OK, now this one's a little bit different:
NSData *gbChineseText = [string
dataUsingEncoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEnc
odingGB_2312_80)];
Doing all of the above the other way around (converting from encoded
data to NSString) is an exercise left for the reader. Hint: Look at
NSString's -initWith
Data:encoding: method...
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
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.