diff options
Diffstat (limited to 'lib/webrick/htmlutils.rb')
-rw-r--r-- | lib/webrick/htmlutils.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/webrick/htmlutils.rb b/lib/webrick/htmlutils.rb index ed901f1ce2..4cb3d0d7f6 100644 --- a/lib/webrick/htmlutils.rb +++ b/lib/webrick/htmlutils.rb @@ -15,12 +15,13 @@ module WEBrick # Escapes &, ", > and < in +string+ def escape(string) - str = string ? string.dup : "" + return "" unless string + str = string.b str.gsub!(/&/n, '&') str.gsub!(/\"/n, '"') str.gsub!(/>/n, '>') str.gsub!(/</n, '<') - str + str.force_encoding(string.encoding) end module_function :escape |