Commit 68c659ec9a33790d3c2a11270ad2beef09db8235
Exists in
master
and in
29 other branches
Merge branch 'fix-feed-encoding' into 'master'
Fix: force utf-8 on content from external feeds Error with feeds encoded with 8-bit ascii: "#<Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)>" Example of feed that wasn't working: http://www.bahiacooperativo.coop.br/rss/feed.xml See merge request !677
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
lib/feed_handler.rb
... | ... | @@ -25,7 +25,7 @@ class FeedHandler |
25 | 25 | def parse(content) |
26 | 26 | raise FeedHandler::ParseError, "Content is nil" if content.nil? |
27 | 27 | begin |
28 | - return FeedParser::Feed::new(content) | |
28 | + return FeedParser::Feed::new(content.force_encoding('utf-8')) | |
29 | 29 | rescue Exception => ex |
30 | 30 | raise FeedHandler::ParseError, "Invalid feed format." |
31 | 31 | end | ... | ... |