1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi.rb (CGI::unescapeHTML): consider ISO-8859-1.

[ruby-dev:35936]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-08-24 02:27:47 +00:00
parent 82dc949bba
commit 55742dce2d
2 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,8 @@
Sun Aug 24 11:26:54 2008 NARUSE, Yui <naruse@ruby-lang.org>
* lib/cgi.rb (CGI::unescapeHTML): consider ISO-8859-1.
[ruby-dev:35936]
Sun Aug 24 10:55:00 2008 NARUSE, Yui <naruse@ruby-lang.org>
* enc/emacs_mule.c: support Emacs/Mule internal encoding.

View file

@ -396,18 +396,20 @@ class CGI
when 'gt' then '>'
when 'lt' then '<'
when /\A#0*(\d+)\z/
if enc == Encoding::UTF_8
$1.to_i.chr(enc)
elsif $1.to_i < 128 && asciicompat
$1.to_i.chr
n = $1.to_i
if enc == Encoding::UTF_8 or
enc == Encoding::ISO_8859_1 && n < 256 or
asciicompat && n < 128
n.chr(enc)
else
"&##{$1};"
end
when /\A#x([0-9a-f]+)\z/i
if enc == Encoding::UTF_8
$1.hex.chr(enc)
elsif $1.hex < 128 && asciicompat
$1.hex.chr
n = $1.hex
if enc == Encoding::UTF_8 or
enc == Encoding::ISO_8859_1 && n < 256 or
asciicompat && n < 128
n.chr(enc)
else
"&#x#{$1};"
end