NSString vs. unicode encoding
NSString vs. unicode encoding
- Subject: NSString vs. unicode encoding
- From: Johan Kool <email@hidden>
- Date: Tue, 15 Sep 2009 21:04:47 -0700
Dear list,
I need to work with strings as in stringA. (I don't have much choice,
but to have it in a NSString at the start.) I want to have the
readable output "hello world".
NSString *stringA = @"hello\040world";
NSString *stringB = [NSString stringWithUTF8String:"hello\040world"] ;
// This works, so I know NSString can deal with the encoding I have in
stringA
NSLog(stringB);
// This does not work (as expected)
NSLog([NSString stringWithUTF8String:[stringA UTF8String]]);
// Nor does this work
NSLog([NSString stringWithUTF8String:[[stringA
dataUsingEncoding:NSUTF8StringEncoding] bytes]]);
// Or this for that matter
NSLog([NSString stringWithUTF8String:[[stringA
dataUsingEncoding:NSASCIIStringEncoding] bytes]]);
Any suggestions for how I could do this? I haven't been able to locate
much about this in the documentation or by searching Google.
Thanks!!
Johan
---
http://www.johankool.nl/
KOOLISTOV - Software for Mac and iPhone
http://www.koolistov.net/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden