Re: Tiger bug on NSXMLParser?
Re: Tiger bug on NSXMLParser?
- Subject: Re: Tiger bug on NSXMLParser?
- From: Jens Alfke <email@hidden>
- Date: Tue, 29 Apr 2008 17:36:43 -0700
On 29 Apr '08, at 6:27 AM, Lorenzo Thurman wrote:
I tried loading the XML into an NSString using
initWithContentsOfURL:encoding:error using Latin1 encoding. Under
Leopard, the XML is read in just fine. I can output the resulting
string in the debugger and it looks good and is parsed just fine.
Under Tiger, the string is just a bunch of unicode escape sequences
and results in another empty document error after running through
NSXMLParser. I'm running on PPC with 10.4.11, if that matters at all.
Sounds like the document is not actually in ISO-Latin-1. It may be
that Leopard is detecting that you gave the wrong encoding and using
the correct one specified by the server instead, whereas Tiger just
uses what you gave it.
It's pretty rare that you need to force an encoding when downloading
text from a URL. Try using this NSString method, which will try to
determine the encoding automatically (either from the HTTP headers or
by sniffing the bytes):
+ (id)stringWithContentsOfURL:(NSURL *)url usedEncoding:
(NSStringEncoding *)enc error:(NSError **)error;
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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