Re: Converting Japanese C- string to NSString
Re: Converting Japanese C- string to NSString
- Subject: Re: Converting Japanese C- string to NSString
- From: John Stiles <email@hidden>
- Date: Thu, 5 Feb 2004 11:30:03 -0800
On Feb 5, 2004, at 9:17 AM, Darrin Cardani wrote:
At 2:02 AM -0800 2/5/04, email@hidden wrote:
How to convert C-string that contains japanese character to NSString?
Check out Carbon's text encoding converter. If the string is in a
Japanese Mac encoding, you can create a Mac to Unicode converter and
pass it the string. You can then put the Unicode bytes you get back
into an NSString with
NSString* newString = [ NSString stringWithCharacters:macStr
length:numBytes ];
That's an awful lot of work. You can use NSString's
initWithBytes:length:encoding:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSString.html#//apple_ref/doc/uid/20000154/
BCIGDAHA
And it allows you to pass in the encoding of your string. A list of
valid NSStringEncodings is at:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/TypesAndConstants/FoundationTypes.html#//apple_ref/doc/
uid/20000018/BAJJAICE
(And if you want more NSStringEncodings to use, you can convert from
the many CFStringEncodings with
CFStringConvertEncodingToNSStringEncoding:
http://developer.apple.com/documentation/CoreFoundation/Reference/
CFStringRef/Reference/function_group_5.html#//apple_ref/c/func/
CFStringConvertEncodingToNSStringEncoding
http://developer.apple.com/documentation/CoreFoundation/Reference/
CFStringRef/Reference/ConstantGroupIndex.html#//apple_ref/doc/uid/
20001211/C012715
http://developer.apple.com/documentation/CoreFoundation/Reference/
CFStringRef/Reference/ConstantGroupIndex.html#//apple_ref/doc/uid/
20001211/BCIHAEFA
)
_______________________________________________
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.