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

* lib/cgi.rb: $KCODE always holds its value in upper case.

* lib/jcode.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2009-03-24 15:21:49 +00:00
parent cc5585f5b5
commit 45b794e814
3 changed files with 27 additions and 21 deletions

View file

@ -1,3 +1,9 @@
Wed Mar 25 00:20:38 2009 Akinori MUSHA <knu@iDaemons.org>
* lib/cgi.rb: $KCODE always holds its value in upper case.
* lib/jcode.rb: Ditto.
Mon Mar 23 21:54:20 2009 Akinori MUSHA <knu@iDaemons.org>
* process.c: Eliminate an "unused variable" warning.

View file

@ -378,7 +378,7 @@ class CGI
if Integer($1) < 256
Integer($1).chr
else
if Integer($1) < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)
if Integer($1) < 65536 and $KCODE[0] == ?U
[Integer($1)].pack("U")
else
"&##{$1};"
@ -388,7 +388,7 @@ class CGI
if $1.hex < 256
$1.hex.chr
else
if $1.hex < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)
if $1.hex < 65536 and $KCODE[0] == ?U
[$1.hex].pack("U")
else
"&#x#{$1};"

View file

@ -24,32 +24,32 @@ class String
RE_UTF8 = Regexp.new(PATTERN_UTF8, 0, 'n')
SUCC = {}
SUCC['s'] = Hash.new(1)
SUCC[?S] = Hash.new(1)
for i in 0 .. 0x3f
SUCC['s'][i.chr] = 0x40 - i
SUCC[?S][i.chr] = 0x40 - i
end
SUCC['s']["\x7e"] = 0x80 - 0x7e
SUCC['s']["\xfd"] = 0x100 - 0xfd
SUCC['s']["\xfe"] = 0x100 - 0xfe
SUCC['s']["\xff"] = 0x100 - 0xff
SUCC['e'] = Hash.new(1)
SUCC[?S]["\x7e"] = 0x80 - 0x7e
SUCC[?S]["\xfd"] = 0x100 - 0xfd
SUCC[?S]["\xfe"] = 0x100 - 0xfe
SUCC[?S]["\xff"] = 0x100 - 0xff
SUCC[?E] = Hash.new(1)
for i in 0 .. 0xa0
SUCC['e'][i.chr] = 0xa1 - i
SUCC[?E][i.chr] = 0xa1 - i
end
SUCC['e']["\xfe"] = 2
SUCC['u'] = Hash.new(1)
SUCC[?E]["\xfe"] = 2
SUCC[?U] = Hash.new(1)
for i in 0 .. 0x7f
SUCC['u'][i.chr] = 0x80 - i
SUCC[?U][i.chr] = 0x80 - i
end
SUCC['u']["\xbf"] = 0x100 - 0xbf
SUCC[?U]["\xbf"] = 0x100 - 0xbf
def mbchar?
case $KCODE[0]
when ?s, ?S
when ?S
self =~ RE_SJIS
when ?e, ?E
when ?E
self =~ RE_EUC
when ?u, ?U
when ?U
self =~ RE_UTF8
else
nil
@ -58,11 +58,11 @@ class String
def end_regexp
case $KCODE[0]
when ?s, ?S
when ?S
/#{PATTERN_SJIS}$/on
when ?e, ?E
when ?E
/#{PATTERN_EUC}$/on
when ?u, ?U
when ?U
/#{PATTERN_UTF8}$/on
else
/.$/on
@ -78,7 +78,7 @@ class String
def succ!
reg = end_regexp
if $KCODE != 'NONE' && self =~ reg
succ_table = SUCC[$KCODE[0,1].downcase]
succ_table = SUCC[$KCODE[0]]
begin
self[-1] += succ_table[self[-1]]
self[-2] += 1 if self[-1] == 0