diff --git a/script/import_scripts/xenforo.rb b/script/import_scripts/xenforo.rb index 217c956369b..6d0ae334feb 100644 --- a/script/import_scripts/xenforo.rb +++ b/script/import_scripts/xenforo.rb @@ -156,6 +156,12 @@ class ImportScripts::XenForo < ImportScripts::Base # phpBB shortens link text like this, which breaks our markdown processing: # [http://answers.yahoo.com/question/index ... 223AAkkPli](http://answers.yahoo.com/question/index?qid=20070920134223AAkkPli) # + #Fix for the error: xenforo.rb: 160: in `gsub!': invalid byte sequence in UTF-8 (ArgumentError) + if ! s.valid_encoding? + s = s.encode("UTF-16be", invalid: :replace, replace: "?").encode('UTF-8') + end + #End Fix + # Work around it for now: s.gsub!(/\[http(s)?:\/\/(www\.)?/, '[')