Re: NSXMLDocument encoding
Re: NSXMLDocument encoding
- Subject: Re: NSXMLDocument encoding
- From: Robert Cerny <email@hidden>
- Date: Mon, 05 May 2008 23:52:49 +0200
Hi,
On 5.5.2008, at 23:14, Jens Alfke wrote:
On 5 May '08, at 12:53 PM, Robert Cerny wrote:
doc = [[NSXMLDocument alloc] initWithData:webData
options:NSXMLDocumentTidyHTML
error:&error];
Try using -initWithContentsOfURL: instead — then it can see the HTTP
headers, which might describe the encoding.
good idea, but it didn't change anything
You don't get an error back in the 'error' parameter?
Error Domain=NSXMLParserErrorDomain Code=1 UserInfo=0x12d8300 "line
217 column 9376 - Warning: discarding invalid character code 141
line 298 column 210 - Warning: '<' + '/' + letter not allowed here
line 298 column 217 - Warning: '<' + '/' + letter not allowed here
line 49 column 11 - Warning: <table> lacks "summary" attribute
line 217 column 1 - Warning: <table> lacks "summary" attribute
Info: Doctype given is "-//W3C//DTD XHTML 1.0 Transitional//EN"
Info: Document content looks like XHTML 1.0 Transitional
5 warnings, 0 errors were found!
However I don't get correctly encoded data from NSXMLNodes
Well, what *do* you get? Show us the data and what you expected.
I get the data in us-ascii encoding. The accented characters are
missing from output or changed to wrong letters
When I get contents of URL as NSData and convert it to [NSString
initWithData:(NSData *)data encoding:(NSStringEncoding)encoding]
and provide NSWindowsCP1250Encoding, I get correct result.
Then you could use the -initWithXMLString: initializer instead...
—Jens
Robert
_______________________________________________
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