On May 5, 2008, at 2:53 PM, Robert Cerny wrote:

I use NSXMLDocument to parse web page content, which is in NSWindowsCP1250Encoding. However I don't get correctly encoded data from NSXMLNodes

NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSData *webData = [NSURLConnection sendSynchronousRequest:req
                                   returningResponse:&response
                                           error:&error];
doc = [[NSXMLDocument alloc] initWithData:webData
                                options:NSXMLDocumentTidyHTML
                                  error:&error];
[doc setCharacterEncoding:@"windows-1250"];

does anyone have an idea what's wrong?


You're going to have to provide more detail. For example, given a starting string, how is it getting mangled?

The best thing to do for encoding issues is to divide and conquer to see where there problem(s) is/are.

For example, how exactly is the data from the web-site handled? e.g. does the URL point directly to an XML file? Is there something about the HTTP header that is specifying the wrong encoding?

Is there an encoding attribute in the XML file itself?
___________________________________________________________
Ricky A. Sharp         mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to