Commit 3a8a114a025e9334a7e3d37a62118cfe54d29e1c
1 parent
b045445d
Exists in
master
and in
1 other branch
Fix for Nokogiri::XML::SyntaxError - Invalid UTF-8. Repack xml as unicode to fix…
… any invalid characters.
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
lib/hoptoad.rb
... | ... | @@ -9,6 +9,7 @@ module Hoptoad |
9 | 9 | end |
10 | 10 | |
11 | 11 | def self.parse_xml(xml) |
12 | + xml = xml.unpack('C*').pack('U*') # Repack string into Unicode to fix invalid UTF-8 chars | |
12 | 13 | parsed = ActiveSupport::XmlMini.backend.parse(xml)['notice'] |
13 | 14 | raise ApiVersionError.new(parsed['version']) unless parsed && parsed['version'].to_s == '2.0' |
14 | 15 | rekeyed = rekey(parsed) | ... | ... |