Re: Text file
Re: Text file
- Subject: Re: Text file
- From: Henrietta Read <email@hidden>
- Date: Sun, 18 Apr 2010 00:40:22 -0700
>> The call to -stringWithContentsOfFile: looks correct, but you're failing
to check for errors. If it fails, it will return nil, and passing nil to
setString: is illegal and will throw an exception.
right, right... most correct. I can catch the nil.
>> This leaves the question of why -stringWithContentsOfFile: would fail.
I'm not sure what heuristics that call uses, but you'd think it would be
able to handle MacRoman, obsolete though it is.
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:
--
"*These try to determine the encoding, and return the encoding which was
used. Note that these methods might get "smarter" in subsequent releases of
the system, and use additional techniques for recognizing encodings. If nil
is returned, the optional error return indicates problem that was
encountered (for instance, file system or encoding errors).*"
--
...alas poor lost MacRoman.
_______________________________________________
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