Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unicode console NSString NSLog unichar etc.



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: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >unicode console NSString NSLog unichar etc. (From: Ben Dougall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.