PDA

View Full Version : Problem with TouchXML and UTF-8




dutchchilly
Jul 18, 2010, 07:30 PM
Hi,

I'm trying to get RSS data from a 3rd party website.
The header of the feed is:


<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">


The code was running fine until an article was added with the '' character in it.
My log shows the message "Input is not proper UTF-8, indicate encoding".

Is there a workaround for it, as I cannot change the header of the RSS feed?

Thanks in advance

Edit: Found it, I've should have used 'NSISOLatin1StringEncoding' for the encoding option. It works now.



patsalko
Jul 24, 2010, 08:43 AM
Hi,

I'm trying to get RSS data from a 3rd party website.
The header of the feed is:


<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">


The code was running fine until an article was added with the '' character in it.
My log shows the message "Input is not proper UTF-8, indicate encoding".

Is there a workaround for it, as I cannot change the header of the RSS feed?

Thanks in advance

Edit: Found it, I've should have used 'NSISOLatin1StringEncoding' for the encoding option. It works now.
Hello.
I am having the same issue.
How exactly and where did you set NSISOLatin1StringEncoding option???

Thanks!

patsalko
Jul 25, 2010, 10:45 AM
never mind. Solved it.

seepel
Jul 25, 2010, 12:27 PM
never mind. Solved it.

How did you solve it?

dutchchilly
Jul 26, 2010, 02:42 PM
CXMLDocument *rssParser = [[[CXMLDocument alloc] initWithContentsOfURL:url encoding:NSISOLatin1StringEncoding options:0 error:nil] autorelease];

namanhams
Jul 27, 2010, 04:15 AM
I also had the same problem and here's how i solve it : first convert data to string, then using the string to build the CXMLDocument.

// assume 'data' is what you get from the web service
NSString *s = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];

CXMLDocument *document = [[[CXMLDocument alloc] initWithXMLString:s options:0 error:error] autorelease];