Re: NSString creating problem when contains chinese font
Re: NSString creating problem when contains chinese font
- Subject: Re: NSString creating problem when contains chinese font
- From: "M. Uli Kusterer" <email@hidden>
- Date: Wed, 1 Oct 2003 19:49:18 +0200
At 11:23 Uhr -0400 01.10.2003, Calvin Hou wrote:
//Modify one chinese character, if don't changed, everything is fine.
contents[55] = 0xB8; contents[56] = 0x71;
// Create NSString temp which will be displayed in NSTextView
NSString * temp = [[NSString alloc] initWithUTF8String: contents];
Jus a guess:
Either the comment is wrong, or you're using the wrong encoding. You
say "modify ONE chinese character". But you're changing two bytes to
binary values. Then you're saying initWithUTF8String. UTF8 uses
eight-bit (one byte) characters and escape sequences to specify
characters.
Make sure the loaded string is what you expect (by logging
"contents") and find out what its encoding is. Chances are, that it's
Apple's old encoding and not Unicode, or if it is Unicode, that you
are expecting the old encoding.
I'm not a Unicode guru, but IIRC Unicode escape sequences mainly
stick to low-range ASCII values and use sequences that look something
like "//1234" to indicate characters that can't be represented in 8
bits.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.