attempted fix for weird encoding problem

This commit is contained in:
Kyle Drake 2015-02-21 09:00:17 -08:00
parent 1f01baf664
commit cb1bb24d86

View file

@ -59,7 +59,10 @@ def encoding_fix(file)
begin begin
Rack::Utils.escape_html file Rack::Utils.escape_html file
rescue ArgumentError => e rescue ArgumentError => e
return Rack::Utils.escape_html(file.force_encoding('BINARY')) if e.message =~ /invalid byte sequence in UTF-8/ if e.message =~ /invalid byte sequence in UTF-8/ ||
e.message =~ /incompatible character encodings/
return Rack::Utils.escape_html(file.force_encoding('BINARY'))
end
fail fail
end end
end end