[Bug:1.9] ArgumentError on "%c" % 0x80


#1

“%c” % 0x80 e$B$,Nc30$K$J$j$^$9!#e(B

% ./ruby -ve ‘"%c" % 0x80’
ruby 1.9.0 (2008-10-09 revision 19723) [i686-linux]
-e:1: warning: useless use of % in void context
-e:1:in %': negative string size (or size too big) (ArgumentError) from -e:1:in

1.8 e$B$G$O$J$j$^$;$s!#e(B

% ruby-1.8 -ve ‘"%c" % 0x80’
ruby 1.8.7 (2008-09-03 revision 17572) [i686-linux]
-e:1: warning: useless use of % in void context


#2

In article removed_email_address@domain.invalid,
Tanaka A. removed_email_address@domain.invalid writes:

“%c” % 0x80 e$B$,Nc30$K$J$j$^$9!#e(B

e$B$&$%$`!#%m%1!<%k$K0MB8$7$F$$$k$h$&$G$9$M!#e(B

EUC-JP e$B$G$O$*$-$^$9!#e(B

% LANG=ja_JP.EUC-JP ./ruby -ve ‘"%c" % 0x80’
ruby 1.9.0 (2008-10-09 revision 19725) [i686-linux]
-e:1: warning: useless use of % in void context
-e:1:in %': negative string size (or size too big) (ArgumentError) from -e:1:in
zsh: exit 1 LANG=ja_JP.EUC-JP ./ruby -ve ‘"%c" % 0x80’

UTF-8 e$B$G$O$*$-$^$;$s!#e(B

% LANG=ja_JP.UTF-8 ./ruby -ve ‘"%c" % 0x80’
ruby 1.9.0 (2008-10-09 revision 19725) [i686-linux]
-e:1: warning: useless use of % in void context

7bit e$B$JJ8;zNs$N%(%s%3!<%G%#%s%0$re(B US-ASCII e$B$K$7$J$/$J$C$?$3e(B
e$B$H$N1F6A$H$b$$$($k$+$J$!!#e(B


#3

e$B@.@%$G$9!#e(B

Tanaka A. wrote:

ruby 1.9.0 (2008-10-09 revision 19725) [i686-linux]

7bit e$B$JJ8;zNs$N%(%s%3!<%G%#%s%0$re(B US-ASCII e$B$K$7$J$/$J$C$?$3e(B
e$B$H$N1F6A$H$b$$$($k$+$J$!!#e(B

printf("%c", codepoint) e$B$H$$$&2r<a$K$J$j$^$9$N$G!"e(B
EUC-JP e$B$GNc30$H$$$&$N$OBEEv$JF0:n$@$H;W$$$^$9!#e(B

e$BNc30$NFbMF$,8m$C$F$$$k5$$O$7$^$9$M!#e(B


#4

e$B%A%1%C%He(B #624 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE)

e$B%+%F%4%je(B M17Ne$B$K%;%C%He(B
e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

r19737 e$B$Ge(B `%’: invalid character (ArgumentError)
e$B$rJV$9$h$&$K$J$j$^$7$?e(B


http://redmine.ruby-lang.org/issues/show/624