Update xenforo.rb (#5622)
#Fix for the error: xenforo.rb: 160: in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)
This commit is contained in:
parent
88fdc926d1
commit
4b8ff7a057
|
@ -156,6 +156,12 @@ class ImportScripts::XenForo < ImportScripts::Base
|
||||||
# phpBB shortens link text like this, which breaks our markdown processing:
|
# 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)
|
# [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:
|
# Work around it for now:
|
||||||
s.gsub!(/\[http(s)?:\/\/(www\.)?/, '[')
|
s.gsub!(/\[http(s)?:\/\/(www\.)?/, '[')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue