зеркало из https://github.com/github/ruby.git
* 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:
Родитель
82dc949bba
Коммит
55742dce2d
|
@ -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>
|
Sun Aug 24 10:55:00 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* enc/emacs_mule.c: support Emacs/Mule internal encoding.
|
* enc/emacs_mule.c: support Emacs/Mule internal encoding.
|
||||||
|
|
18
lib/cgi.rb
18
lib/cgi.rb
|
@ -396,18 +396,20 @@ class CGI
|
||||||
when 'gt' then '>'
|
when 'gt' then '>'
|
||||||
when 'lt' then '<'
|
when 'lt' then '<'
|
||||||
when /\A#0*(\d+)\z/
|
when /\A#0*(\d+)\z/
|
||||||
if enc == Encoding::UTF_8
|
n = $1.to_i
|
||||||
$1.to_i.chr(enc)
|
if enc == Encoding::UTF_8 or
|
||||||
elsif $1.to_i < 128 && asciicompat
|
enc == Encoding::ISO_8859_1 && n < 256 or
|
||||||
$1.to_i.chr
|
asciicompat && n < 128
|
||||||
|
n.chr(enc)
|
||||||
else
|
else
|
||||||
"&##{$1};"
|
"&##{$1};"
|
||||||
end
|
end
|
||||||
when /\A#x([0-9a-f]+)\z/i
|
when /\A#x([0-9a-f]+)\z/i
|
||||||
if enc == Encoding::UTF_8
|
n = $1.hex
|
||||||
$1.hex.chr(enc)
|
if enc == Encoding::UTF_8 or
|
||||||
elsif $1.hex < 128 && asciicompat
|
enc == Encoding::ISO_8859_1 && n < 256 or
|
||||||
$1.hex.chr
|
asciicompat && n < 128
|
||||||
|
n.chr(enc)
|
||||||
else
|
else
|
||||||
"&#x#{$1};"
|
"&#x#{$1};"
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче