Skip to content

Commit

Permalink
CGI.escapeHTML restore the original encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ahorek committed Mar 2, 2020
1 parent 06bcc6e commit 6ba4e4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/ruby/stdlib/cgi/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ def escapeHTML(string)
table = Hash[TABLE_FOR_ESCAPE_HTML__.map {|pair|pair.map {|s|s.encode(enc)}}]
string = string.gsub(/#{"['&\"<>]".encode(enc)}/, table)
string.encode!(origenc) if origenc
return string
string
else
string = string.b
string.gsub!(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
string.force_encoding(enc)
end
string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
end

begin
Expand Down
1 change: 0 additions & 1 deletion spec/tags/ruby/library/cgi/escapeHTML_tags.txt

This file was deleted.

0 comments on commit 6ba4e4a

Please sign in to comment.