Is there a way to “auto detect” the encoding of a resource when loading it using stringFromContentsOfURL?
Is there a way to "auto detect" the encoding of a resource when loading it using stringFromContentsOfURL? The current (non-depracated) method, + (id)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error; , wants a URL encoding. I've noticed that getting it wrong does make a difference for what I want to do. Is there a way to check this somehow and always get it right? (Right now I'm using UTF8.) Dave.B I'd try this function from the docs Returns a string created by reading data from a given URL and returns by reference the encoding used to interpret the