On Apr 18, 2010, at 12:40 AM, Henrietta Read wrote:

> exactly the point germane, but in perusing NSString.h one is given to 
> understand this method might not be as 'smart' as one could wish:

I wouldn’t think it would fail with MacRoman, though. Did you check the output 
NSError? Also, try inspecting the file with a hex editor … maybe there are some 
invisible null bytes or control characters.

What I usually do in cases like this, when trying to decode arbitrary data to 
strings, is to fall back to assuming NSWindowsCP1252StringEncoding. This is (a) 
a very common encoding [the default on most Windows systems], (b) fairly 
standard (it’s a superset of ISO-Latin-1), and (c) always works since it 
encodes all 256 bytes values.

—Jens_______________________________________________

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