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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to