[Bug #1506] irbで日本語を入力できない


#1

Bug #1506: irbe$B$GF|K\8l$rF~NO$G$-$J$$e(B
http://redmine.ruby-lang.org/issues/show/1506

e$B5/I<<Te(B: Nobuhiro IMAI
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.9.2dev (2009-05-23 trunk 23548) [i686-linux]

[ruby-dev:36198]e$B$HF1$8$+$b$7$l$J$$$N$G$9$,!"e(BGNU
readlinee$B$G$bF~NO=PMh$J$$$N$GJs9p$7$^$9!#e(B

$ uname -a
Linux ribot 2.6.29-1-686 #1 SMP Fri Apr 17 14:35:16 UTC 2009 i686
GNU/Linux
$ ruby1.9 -v
ruby 1.9.2dev (2009-05-23 trunk 23548) [i686-linux]
$ echo $LANG
ja_JP.UTF-8
$ irb1.9 -f
irb(main):001:0> ENCODING
=> #Encoding:UTF-8
irb(main):002:0> :e$B$"$"$"e(B
/home/nov/ruby/lib/ruby/1.9.1/irb/ruby-lex.rb:539:in `block in
lex_int2: invalid byte sequence in UTF-8 (ArgumentError)

irb(main):002:0>
e$B$N9T$O!Ve(B:e$B$"$"$"!W$HF~NO$7$F$k$D$b$j$J$N$G$9$,!"e(B
\x3a\xe3\xe3 e$B$_$?$$$J$N$,=PNO$5$l$F$k$h$&$G$9!#e(B

readline e$B$r;H$o$J$+$C$?$j!"e(B

$ irb1.9 -f --noreadline
irb(main):001:0> :e$B$"$"$e(B
=> :e$B$$"$"e(B

r23298 e$B$KLa$9$H$&$^$/F0$/$N$G!"e(B
r23299 e$B$,860x$G$O$J$$$+$H;W$&$N$G$9$,!D!De(B

$ irb1.9 -f --readline
irb(main):001:0> RUBY_DESCRIPTION
=> ruby 1.9.2dev (2009-04-27 trunk 23298) [i686-linux]
irb(main):002:0> :e$B$"$"$e(B
=> :e$B$$"$"e(B


#2

e$B$$$^$$$G$9!#e(B

From: Nobuhiro IMAI <redmine_at_ruby-lang.org>
Date: Sat, 23 May 2009 19:27:16 +0900

irb(main):002:0> e$B$N9T$O!Ve(B:e$B$"$"$"!W$HF~NO$7$F$k$D$b$j$J$N$G$9$,!"e(B
\x3a\xe3\xe3 e$B$_$?$$$J$N$,=PNO$5$l$F$k$h$&$G$9!#e(B

Readline.input= e$B$Ke(B IO
e$B$rEO$9$H$*$+$7$/$J$k$h$&$G$9!#J8;zC10L$G<h$l$F$ke(B
e$B$1$I!"%P%$%HC10L$G$7$+=PNO$5$l$F$J$$!)e(B

$ cat rl.rb

-- coding: utf-8 --

p DATA.external_encoding
p DATA.getc
require readline
Readline.input = DATA
p Readline.readline(">> , false)
END
e$B$$"$"$"e(B
$ ruby1.9 -v rl.rb
ruby 1.9.2dev (2009-05-26 trunk 23576) [i686-linux]
#Encoding:UTF-8
"e$B$e(B

??
\xE3\xE3

?? e$B$Oe(B \xE3\xE3 e$B$G$9!#e(B\xE3

e$B$O!V$"!W$N@hF,$N%P%$%H$G$9$h$M!#e(B


#3

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

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r23591.

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