Johan Kool wrote:

NSString *stringA = @"J\\303\\270ha\\314\\212n\\040i\\314\\210s\ \040Li\ \314\\200e\\314\\201\\306\\222";
NSLog(@"stringA %@ (expected Jøhån ïs Lìéƒ)", stringA);


You're doing it wrong. NSNonLossyASCIIStringEncoding expects one escaped unit per Unicode code-point. It doesn't parse "multi-byte" forms like "\\303\\270", which I assume is intended to be something like an octal-escaped UTF8 encoding.

To get a sense for what it wants as input, I recommend that you create a test with some hard-wired strings, then convert to bytes using the NSNonLossyASCIIStringEncoding, and dump the resulting ASCII text. Or you could use TextEdit.app and save or open as non-lossy ASCII.

  -- GG

_______________________________________________

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