diff --git a/lib/canvas/migration/xml_helper.rb b/lib/canvas/migration/xml_helper.rb index d8df5b0601e..6df63d1b912 100644 --- a/lib/canvas/migration/xml_helper.rb +++ b/lib/canvas/migration/xml_helper.rb @@ -100,7 +100,12 @@ module XMLHelper if doc.encoding != 'UTF-8' begin doc.at_css('*') + rescue ArgumentError => e + # ruby 2.2 + raise unless e.message =~ /^invalid byte sequence/ + doc.encoding = 'UTF-8' rescue Encoding::CompatibilityError + # ruby 2.1 doc.encoding = 'UTF-8' end end