Commit 288199b70036035c7c67e9617a1264851d438d6c

Authored by Daniela Feitosa
1 parent 00d46ded

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)>"
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
lib/feed_handler.rb
@@ -25,7 +25,7 @@ class FeedHandler @@ -25,7 +25,7 @@ class FeedHandler
25 def parse(content) 25 def parse(content)
26 raise FeedHandler::ParseError, "Content is nil" if content.nil? 26 raise FeedHandler::ParseError, "Content is nil" if content.nil?
27 begin 27 begin
28 - return FeedParser::Feed::new(content) 28 + return FeedParser::Feed::new(content.force_encoding('utf-8'))
29 rescue Exception => ex 29 rescue Exception => ex
30 raise FeedHandler::ParseError, "Invalid feed format." 30 raise FeedHandler::ParseError, "Invalid feed format."
31 end 31 end