initWithContentsOfFile:usedEncoding:error: Not working?
initWithContentsOfFile:usedEncoding:error: Not working?
- Subject: initWithContentsOfFile:usedEncoding:error: Not working?
- From: Larry Fransson <email@hidden>
- Date: Tue, 11 Apr 2006 00:05:31 -0700
I'm trying to initialize a string using NSString -
initWithContentsOfFile:usedEncoding:error:. I'm getting an error
(#261) that says the file can't be opened using the specified text
encoding. This happens whether I specify an encoding or not.
According to the docs, this method is supposed to try to determine
the encoding used and return it by reference.
On the other hand, if I use -initWithContentsOfFile:encoding:error:
and specify NSUTF8StringEncoding, it works fine. If I could count on
the files I'm opening always being in UTF8 encoding, that would be
great. But I'm not sure that's realistic given that TextEdit's
default encoding for plain text is Mac OS Roman. I suppose the other
solution is to iterate over every possible encoding until I don't get
an error.
So am I using the first method the wrong way, or is not working?
Larry Fransson
Subcritical
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden