On Sat, Feb 7, 2009 at 12:46 PM, Joar Wingfors <j...@joar.com> wrote:
>
> On Feb 7, 2009, at 6:55 AM, Steve Sisak wrote:
>
>> Umm, unless I'm totally missing something, what's wrong with fopen() and
>> fgets(), possibly followed with [NSString stringWithCString] on each line?
>
>
> What's wrong is that they won't allow you to specify the text encoding to
> use. The same thing is true for the *deprecated* method
> "+stringWithCString:" by the way.

That is incorrect. What they don't do is care about encoding at all.
They treat the input stream as an opaque bag of bytes, aside from
looking for the line-ending characters. This means that it is almost
completely encoding agnostic, and will work for the vast majority of
text encodings.

This is not at all the same thing as +stringWithCString:. That one
tries to convert the given string to Unicode. That means that if it
uses the incorrect encoding, it produces the *wrong* result.

There's a substantial difference between simply passing data through
unconverted and attempting to convert it but getting the conversion
wrong.

Mike
_______________________________________________

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