Parsing Hebrew
bennyDeveloper opened this issue · 2 comments
Hi, I replaced the RSS link to http://www.ynet.co.il/Integration/StoryRss2.xml
And then instead of hebrew i got Gibbrish.
10x in advanced
Benny
I had a similar issue. it's not really an issue with Hebrew or MWFeedParser. ynet encode their RSS feeds incorrectly. (They included a windows-1255 header, while the actual content is in UTF-8...)
Try:
NSData* encodedData;
// YNET FIX (wrong windows-1255 in header) (http://www.ynet.co.il)
if ([[_feed.url substringToIndex:21] isEqual:@"http://www.ynet.co.il"]) {
NSString *content = [[NSString alloc] initWithBytes:[response.data bytes]
length:[response.data length]
encoding: NSASCIIStringEncoding];
content = [content stringByReplacingOccurrencesOfString:@"Windows-1255" withString:@"UTF-8"];
encodedData = [content dataUsingEncoding:NSUTF8StringEncoding];
} else {
encodedData = response.data;
}
10x a lot :)
Benny
2012/2/1 Adar Porat <
reply@reply.github.com
I had a similar issue. it's not really an issue with Hebrew. ynet encode
their RSS feeds incorrectly. (They included a windows-1255 header, while
the actual content is in UTF-8)....Try:
// YNET FIX (wrong windows-1255 in header) (http://www.ynet.co.il) if ([[_feed.url substringToIndex:21] isEqual:@"http://www.ynet.co.il"]) { NSString *content = [[NSString alloc] initWithBytes:[response.data bytes] length:[response.data length] encoding: NSASCIIStringEncoding]; content = [content stringByReplacingOccurrencesOfString:@"Windows-1255" withString:@"UTF-8"]; encodedData = [content dataUsingEncoding:NSUTF8StringEncoding]; } else { encodedData = response.data; }
Reply to this email directly or view it on GitHub:
#45 (comment)
בני דוידוביץ
BDApps
מייסד ומתכנת
052-7790800
benny@bdapps.net