mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cgi/util.rb: Constant parameter is faster and economy than
string parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75cbab7fe1
commit
612143ddc1
1 changed files with 1 additions and 1 deletions
|
@ -44,7 +44,7 @@ module CGI::Util
|
|||
enc = string.encoding
|
||||
if [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].include?(enc)
|
||||
return string.gsub(Regexp.new('&(apos|amp|quot|gt|lt|#[0-9]+|#x[0-9A-Fa-f]+);'.encode(enc))) do
|
||||
case $1.encode("US-ASCII")
|
||||
case $1.encode(Encoding::US_ASCII)
|
||||
when 'apos' then "'".encode(enc)
|
||||
when 'amp' then '&'.encode(enc)
|
||||
when 'quot' then '"'.encode(enc)
|
||||
|
|
Loading…
Add table
Reference in a new issue