Re: unicode console NSString NSLog unichar etc.
Re: unicode console NSString NSLog unichar etc.
- Subject: Re: unicode console NSString NSLog unichar etc.
- From: Ben Dougall <email@hidden>
- Date: Wed, 12 Apr 2006 13:06:04 +0100
okey dokey, sorry -- i've sussed it.
specify the right encoding for the original string. use NSData's
initWithContentsOfFile: which allows you to specify the encoding of the
text file which i found out using BBEdit.
string = [[NSString alloc] initWithData:[NSData
dataWithContentsOfFile:@"/path/file"]
encoding:NSWindowsCP1251StringEncoding];
On Wednesday, April 12, 2006, at 12:52 pm, Ben Dougall wrote:
this has got to be a seriously faq so if anyone could point me
straight to an already written answer it'd be great -- i couldn't find
one.
NSLog(@"%u %x %C, [string characterAtIndex: indx], [string
characterAtIndex: indx], [string characterAtIndex: indx]);
the character i'm looking at for example is ‘ that is the single left
quote. i've got that into my string from a text file by using
initWithContentsOfFile: for NSString. the above print statement
results in:
235 eb \\353
it doesn't seem to tally with any unicode tables that i can see.
single left quote is 8216 and 0x2018. i know the console can't display
unicode chars but what is \\353 ? it doesn't seem to correspond to
anything.
i want to test for the existence of various quote marks. how can i do
that?
thanks, ben.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden