X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fcore%2Futils%2Fhttputil.rb;fp=lib%2Frbot%2Fcore%2Futils%2Fhttputil.rb;h=f7871e5be7dfb34d28a7d84a2c669c6efcff4a5e;hb=be213d7bbcaf0bd91b4c4e78f1d6a1ae3032978b;hp=39a4781662fe4d03512839413b32e04160875129;hpb=633fdf34ed152f06b123e7b3167177bf385f49bb;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb index 39a47816..f7871e5b 100644 --- a/lib/rbot/core/utils/httputil.rb +++ b/lib/rbot/core/utils/httputil.rb @@ -51,6 +51,8 @@ module ::Net debug "charset #{charsets.last} added from header" end + # str might be invalid utf-8 that will crash on the pattern match: + str.encode!('UTF-8', 'UTF-8', :invalid => :replace) case str when /<\?xml\s[^>]*encoding=['"]([^\s"'>]+)["'][^>]*\?>/i charsets << $1