Re: Text file
Re: Text file
- Subject: Re: Text file
- From: Jens Alfke <email@hidden>
- Date: Sun, 18 Apr 2010 12:41:28 -0700
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 (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