M17n of irb


#1

Yuguiです。

irbの多言語化を試みてみました。パッチを添付します。この変更により、

  • ファイルからコードを読む際にmagic commentを解釈します。
  • lex結果に正しくencodingを付けるので、__ENCODING__を使うプログラムが正
    しく動きます。
  • Kconvの代わりにString#encodeを使うので、日本語以外についてもうまくメッ
    セージを変換できる可能性があります。
  • 独自のlocale解析の他にEncoding::LOCALEを使います。

(日本語ヘルプは、どうせならダミーエンコーディングじゃないほうが良いだろ
うと思いまして、ISO-2022-JPからUTF-8に変換しました)

残る問題は-K, -U, -Eをどうやってサポートするかです。(必要ですよね?)

  • default_internal, default_external, default_src_encodingを設定するメ
    ソッドを追åŠ
    => 言語設計ポリシーに反する
  • 設定するための拡張ライブラリを書く
    => ほとんど変わらない
  • rubyプロセスを再spawnする
    => Ruby処理系のパスを確実に得るポータブルな方法がない
  • 設定対象変数のアドレスを取得してdlで無理矢理
    => ポータブルでない

と考えて、IRB.parse_optを拡張ライブラリで書くのが良いのではないかと思い
ました。そんな方向でいかがでしょうか。


#2

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :37161 ] the message: "[ruby-dev:37161] m17n of irb ", on
Nov/24 22:05(JST) “Yugui (Yuki S.)” writes:

Yuguie$B$G$9!#e(B
irbe$B$NB?8@8l2=$r;n$$F$$^$7$?!#%Q%C%A$rE:IU$7$^$9!#$3$NJQ99$K$h$j!"e(B

  • e$B%U%!%$%k$+$i%3!<%I$rFI$`:]$Ke(Bmagic commente$B$r2r<a$7$^$9!#e(B
  • lexe$B7k2L$K@5$7$/e(Bencodinge$B$rIU$1$k$N$G!"e(B__ENCODING__e$B$r;H$&%W%m%0%i%`$,@5e(B
    e$B$7$/F0$-$^$9!#e(B
  • Kconve$B$NBe$o$j$Ke(BString#encodee$B$r;H$&$N$G!“F|K\8l0J30$K$D$$$F$b$&$^$/%a%Ce(B
    e$B%;!<%8$rJQ49$G$-$k2DG=@-$,$”$j$^$9!#e(B
  • e$BFH<+$Ne(Blocalee$B2r@O$NB>$Ke(BEncoding::LOCALEe$B$r;H$$$^$9!#e(B

e$B%Q%C%A$"$j$,$H$&$4$6$$$^$9e(B.

(e$BF|K\8l%X%k%W$O!"$I$&$;$J$i%@%_!<%(%s%3!<%G%#%s%0$8$c$J$$$[$&$,NI$$$@$me(B
e$B$&$H;W$$$^$7$F!"e(BISO-2022-JPe$B$+$ie(BUTF-8e$B$KJQ49$7$^$7$?e(B)

e$B$=$l$O$=$&$@$H$*$b$$$^$9e(B.

e$B;D$kLdBj$Oe(B-K, -U, -Ee$B$r$I$&$d$C$F%5%]!<%H$9$k$+$G$9!#e(B(e$BI,MW$G$9$h$Me(B?)

  • default_internal, default_external, default_src_encodinge$B$r@_Dj$9$k%ae(B
    e$B%=%C%I$rDI2Ce(B
    => e$B8@8l@_7W%]%j%7!<$KH?$9$ke(B
  • e$B@_Dj$9$k$?$a$N3HD%%i%$%V%i%j$r=q$/e(B
    => e$B$[$H$s$IJQ$o$i$J$$e(B
  • rubye$B%W%m%;%9$r:Fe(Bspawne$B$9$ke(B
    => Rubye$B=hM}7O$N%Q%9$r3N<B$KF@$k%]!<%?%V%k$JJ}K!$,$J$$e(B
  • e$B@_DjBP>]JQ?t$N%"%I%l%9$r<hF@$7$Fe(Bdle$B$GL5M}LpM}e(B
    => e$B%]!<%?%V%k$G$J$$e(B

e$B$H9M$($F!"e(BIRB.parse_opte$B$r3HD%%i%$%V%i%j$G=q$/$N$,NI$$$N$G$O$J$$$+$H;W$$e(B
e$B$^$7$?!#$=$s$JJ}8~$G$$$+$,$G$7$g$&$+!#e(B

e$B$&!<$se(B. e$B$7$g$&$,$J$$$s$G$9$+$M$'e(B…

e$B$=$l$Ke(B, e$B$3$NLdBj$Oe(Birbe$B$K8BDj$5$l$k$o$1$G$O$J$/e(B,
e$B30It$+$i$NJ8;zNs$re(Beval
e$B$9$k$h$&$J%W%m%0%i%`$9$Y$F$KEv$F$O$^$j$^$9e(B.
e$B$=$s$J$KB?$$$H$O8@$$$^$;$se(B
e$B$,e(B, e$B$=$l$J$j$K$"$k$3$H$O3N$+$Ge(B,
e$B:#;d$,3+H/$7$F$$$kJL$N=hM}7O$G$bF1$8Lde(B
e$BBj$,$"$j$^$9e(B.

default_internal, default_externale$B$,:F@_Dj$G$-$J$$$N$Oe(B,
2e$BEY@_Dj$5$l$ke(B
e$B$H$I$l$,@5$7$$$N$+J,$+$i$J$/$J$k$+$i$H$N$3$H$N$h$&$G$9$,e(B,
e$B5/F0;~%*%W%7%ge(B
e$B%s$d4D6-JQ?te(BRUBYOPTe$B$Ge(B-Ee$B$G;XDj$5$l$F$$$J$+$C$?$ie(B,
e$B0lEY$@$1$J$iBeF~$,5ve(B
e$B$5$l$F$bNI$$$H;W$&$N$G$9$,e(B, e$B$$$+$,$G$7$g$&$+e(B?

e$B$"$H$Oe(B, IRB.parse_opt e$B$NOC$G5$$,IU$-$^$7$?$,e(B,
default_*e$B$r@_Dj$7$?$/$Je(B
e$B$k$N$Oe(B, e$B%"%W%j%1!<%7%g%s$N=i4|2=;~E@$G$9$N$Ge(B,
lib/optperse.rb e$BJU$j$KAHe(B
e$B$_9~$s$G$7$^$&$H$$$&$N$b$"$j$N$h$&$J5$$,$7$^$9e(B. e$B$?$@e(B,
e$B$3$A$i$N>l9g$G$be(B
e$B0lIt3HD%%i%$%V%i%j2=$OI,MW$K$J$k$3$H$K$J$j$^$9$,e(B,
irbe$B8BDj$NBP1~$G$O$Je(B
e$B$$$N$Ge(B, e$BMxMQ2ACM$O9b$/$J$k$H;W$$$^$9e(B.

e$B$"$He(B, default_src_encodinge$B$C$F2?$G$7$g$&$+e(B?
MLe$BEy$G$O8+3]$1$^$;$s$,e(B?

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—


#3

keiju ISHITSUKA さんは書きました:

うーん. しょうがないんですかねぇ…

それに, この問題はirbに限定されるわけではなく, 外部からの文字列をeval
するようなプログラムすべてに当てはまります. そんなに多いとは言いません
が, それなりにあることは確かで, 今私が開発している別の処理系でも同じ問
題があります.

irbがある種のRuby処理系だから発生する問題であってあまり一般的ではないと
思っていました。あまり一般的な問題であっては欲しくないんですけどねー。

default_internal, default_externalが再設定できないのは, 2度設定される
とどれが正しいのか分からなくなるからとのことのようですが, 起動時オプショ
ンや環境変数RUBYOPTで-Eで指定されていなかったら, 一度だけなら代入が許
されても良いと思うのですが, いかがでしょうか?

既にdefault_internal, default_externalで開かれたリソースが存在する可能性
ãŒã‚ã‚‹ã¨æ€ã„ã¾ã™ã€‚ã§ã™ã‹ã‚‰ã€å¤‰æ›´ã™ã‚‹ãªã‚‰ã°ãã®ãƒªã‚½ãƒ¼ã‚¹ã«å¯¾ã—ã¦è²¬ä»»ã‚’è² ã†
必要があって、あまり気軽に変更して欲しくはないと思います。

言語デザインとしてどうでしょうか? < まつもとさん

言い換えると、「一度だけ代入化」の選択肢ははあり得ますか?
あるんだったら本件は割と簡単になりますよね。

あとは, IRB.parse_opt の話で気が付きましたが, default_*を設定したくな
るのは, アプリケーションの初期化時点ですので, lib/optperse.rb 辺りに組
み込んでしまうというのもありのような気がします. ただ, ã“ã¡ã‚‰ã®å ´åˆã§ã‚‚
一部拡張ライブラリ化は必要になることになりますが, irb限定の対応ではな
いので, 利用価値は高くなると思います.

ちょっとこの話はよく分からないので、風邪が治ったら考えさせてください。

あと, default_src_encodingって何でしょうか? ML等では見掛けませんが?

ruby.cでいうopt->src.encの意図でした。-Kの時に設定される、magic comment
がないときのscript encodingです。-Kのとき以外は常にUS-ASCIIです。

それはそうと、IRB.parse_optsの拡張ライブラリ化を書いちゃったのでとりあえ
ず添付しますね。ただ、このパッチではdefault_internalが設定できません。
rb_enc_set_default_internalが1度しか設定を許さないようになっていて、Ruby
本体のオプション解析の時点で設定されるからです。

この辺りも含めて、デフォルトのエンコーディング設定の変更を許すことが言語
デザイン的にあり得るのかどうかまつもとさんに伺いたいです。
私は結構現状に納得してます。


#4

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :37203 ] the message: "[ruby-dev:37203] Re: m17n of irb
", on Nov/26 20:40(JST) “Yugui (Yuki S.)” writes:

irbe$B$,$"$k<o$Ne(BRubye$B=hM}7O$@$+$iH/@8$9$kLdBj$G$"$C$F$"$^$j0lHLE*$G$O$J$$$He(B
e$B;W$C$F$$$^$7$?!#$"$^$j0lHLE*$JLdBj$G$"$C$F$OM_$7$/$J$$$s$G$9$1$I$M!<!#e(B

irbe$B$H$+$N>l9ge(B,
encodinge$B$r;XDj$7$?$$$N$Oe(Birbe$B$N%f!<%6!<$G$9$+$ie(B.
e$B:#$N$^$^e(B
e$B$@$He(B ruby e$B%l%Y%k$G$O2r7h$G$-$J$$$G$9$h$Me(B…

irbe$B$N$h$&$JIT2DG=%l%Y%k$N%1!<%9$Oe(B,
e$BIQH/$9$k$b$N$G$b$J$$$G$9$,e(B,
default_encodinge$B$N287C$r<u$1$i$l$J$$>l9g$Oe(B,
e$B$+$J$j0lHLE*$J$b$N$K$Je(B
e$B$k$H;W$$$^$9e(B. e$B$H$$$&$N$be(B, default
encodig e$B$Oe(B
e$B4D6-JQ?t$+e(Brubye$B$X$N%*%We(B
e$B%7%g%s$G$N;XDj$7$+$J$$$N$Ge(B, linuxe$BEy$N%3%^%s%I$H$7$?>l9ge(B,
default
**_encoding e$B$N;XDj$Oe(B,
e$B4D6-JQ?t$G$7$+=PMh$J$$$3$H$K$J$j$^$9e(B. e$B$3e(B
e$B$l$C$Fe(B, e$B$+$J$j$NITJX$@$H;W$&$N$G$9$,e(B?

e$B4{$Ke(Bdefault_internal, default_externale$B$G3+$+$l$?%j%=!<%9$,B8:_$9$k2De(B
e$BG=@-$,$"$k$H;W$$$^$9!#e(B

e$B>/$J$/$H$be(B, std{in,out,err}e$B$O3+$$$F$$$^$9$+$i$M$'e(B…

e$B$G$9$+$i!“JQ99$9$k$J$i$P$=$N%j%=!<%9$KBP$7$F@UG$$rIi$&I,MW$,$”$C$F!“e(B
e$B$”$^$j5$7Z$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$N$+$I$&$+$^$D$b$H$5$s$K;G$$$?$$$G$9!#e(B
e$B;d$O7k9=8=>u$KG<F@$7$F$^$9!#e(B

e$B$&!<$se(B. e$BBg:n$"$j$,$H$&$4$6$$$^$9e(B. e$B$?$@e(B,
e$B$3$N$h$&$JJ}K!$8$c$J$/:Q$`$h$&e(B
e$B$K5’$C$F$$$^$9$,e(B(^^;;

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—


#5

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

irbe$B$K8B$i$J$$LdBj$HG’<1$7$Fe(B, e$B%5%V%8%’%/%HJQ$($^$7$?e(B.

In [ruby-dev :37216 ] the message: "[ruby-dev:37216] Re: m17n of irb
", on Nov/28 01:06(JST) “NARUSE, Yui” writes:

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

default_**_encoding e$B$N;XDj$Oe(B, e$B4D6-JQ?t$G$7$+=PMh$J$$$3$H$K$J$j$^$9e(B. e$B$3e(B
e$B$l$C$Fe(B, e$B$+$J$j$NITJX$@$H;W$&$N$G$9$,e(B?
e$BIQHK$K$"$k$o$1$G$O$J$$$1$l$I!"Ev$?$k$H$G$+$$LdBj$@$J$!$H;W$$$^$9!#e(B

e$B0lHLE*$Je(B, e$BIQEY$H8@$o$l$k$HJ,$+$j$^$;$s$,e(B,

ruby -E… script

e$B$H$7$?$/$J$kIQEY$He(B

script -E…

e$B$H$7$?$/$J$kIQEY$Oe(B, e$B$=$l$J$j$N%9%/%j%W%H$G$"$l$Pe(B,
e$BIQEY$O$[$H$s$IF1$8$@e(B
e$B$H;W$$$^$9e(B.

e$B$H$$$&$o$1$Ge(B,
e$B$o$6$o$6e(Brubye$B$N%3%^%s%I%%W%7%g%s$rMQ0U$9$k$J$ie(B,
e$B0lHL$Ne(BOS
e$B$N%3%^%s%I$KBP$7$F$b%3%^%s%I%
%W%7%g%s$H$7$FMxMQ$G$-$k$h$&$J2?$i$+$NJ}e(B
e$BK!$,$"$k$Y$-$@$H;W$&$s$G$9$h$Me(B.

#!/bin/env ruby

handle option: -K, -E, -U

e$BJ}8~$H$7$F$O$3$l$,%Y%9%H$8$c$J$$$G$7$g$&$+!#e(B
e$B$?$@!"%^%8%C%/%3%a%s%H$O$$$^$$$A$+$J$!$H$b!#e(B
e$B$`$7$me(Bshebang e$B9T$Ne(Brubye$B$X$N%*%W%7%g%s$H$+$NJ}$,$$$$$+$J!<$H$+!#e(B

e$B$?$H$($Pe(B:

#!/bin/env ruby --handle_opt -KEU

e$B$J$+$s$8$G$9$h$Me(B?

e$B;d$b:G=i$O$=$l$r9M$($?$N$G$9$,e(B,
shebange$B$Oe(B1e$B0z?t$7$+<h$l$J$+$C$?5$$,$7$?e(B
e$B$N$Ge(B, e$BA0=R$J46$8$K$7$^$7$?e(B.
e$B:#$O$=$s$J9MN8$,I,MW$J$1$l$P$`$7$m$=$NJ}$,e(B
e$BNI$$$H;W$$$^$9e(B. e$B$3$NJU$je(B, e$B$I$&$J$C$F$$$k$s$G$7$g$&$+e(B?

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—


#6

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

keiju ISHITSUKA wrote:

irbe$B$N$h$&$JIT2DG=%l%Y%k$N%1!<%9$Oe(B, e$BIQH/$9$k$b$N$G$b$J$$$G$9$,e(B,
default_encodinge$B$N287C$r<u$1$i$l$J$$>l9g$Oe(B, e$B$+$J$j0lHLE*$J$b$N$K$Je(B
e$B$k$H;W$$$^$9e(B. e$B$H$$$&$N$be(B, default
encodig e$B$Oe(B e$B4D6-JQ?t$+e(Brubye$B$X$N%*%We(B
e$B%7%g%s$G$N;XDj$7$+$J$$$N$Ge(B, linuxe$BEy$N%3%^%s%I$H$7$?>l9ge(B,
default
**_encoding e$B$N;XDj$Oe(B, e$B4D6-JQ?t$G$7$+=PMh$J$$$3$H$K$J$j$^$9e(B. e$B$3e(B
e$B$l$C$F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$s$G$9$,!“e(Birb -K
e$B$O$h$/;H$$$^$9!#e(B
e$BA0$K<+J,MQ$K=q$$$F$$$?%”%W%j%1!<%7%g%s$G$be(B-Ke$B$O;H$C$F$$$?$N$G!"e(B
e$B$?$V$se(B
-Ee$B$b;H$&$h$&$J5$$,$9$k$s$G$9$h$M!#e(B

myapp -E…

e$B$H$7$?$+$C$?%"%W%j%1!<%7%g%s$Oe(B

ruby -E, myapp,rb

e$B$H=q$1$P$h$$$N$+$7$i!#e(B

e$BJ}8~$H$7$F$O$3$l$,%Y%9%H$8$c$J$$$G$7$g$&$+!#e(B
e$B$?$@!"%^%8%C%/%3%a%s%H$O$$$^$$$A$+$J$!$H$b!#e(B
e$B$`$7$me(Bshebang e$B9T$Ne(Brubye$B$X$N%*%W%7%g%s$H$+$NJ}$,e(B
e$B$$$$$+$J!<$H$+!#e(B

e$B%9%/%j%W%H$+$iBeF~$G$-$J$$$N$G$"$l$P!"$3$&$$$C$?:n@o$K;?@.$7$^$9!#e(B


#8

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

Yuguie$B$5$s$K$;$C$D$+$l$^$7$?e(B(e$B>Pe(B

In message “Re: [ruby-dev:37203] Re: m17n of irb”
on Wed, 26 Nov 2008 20:40:31 +0900, “Yugui (Yuki S.)”
removed_email_address@domain.invalid writes:

|e$B4{$Ke(Bdefault_internal, default_externale$B$G3+$+$l$?%j%=!<%9$,B8:$9$k2DG=@-e(B
|e$B$,$"$k$H;W$$$^$9!#$G$9$+$i!“JQ99$9$k$J$i$P$=$N%j%=!<%9$KBP$7$F@UG$$rIi$&e(B
|e$BI,MW$,$”$C$F!"$"$^$j5$7Z$KJQ99$7$FM
$7$/$O$J$$$H;W$$$^$9!#e(B
|
|e$B8@8l%G%6%$%s$H$7$F$I$&$G$7$g$&$+e(B? < e$B$^$D$b$H$5$se(B
|
|e$B8@$$49$($k$H!"!V0lEY$@$1BeF~2=!W$NA*Br;h$O$O$"$jF@$^$9$+e(B?
|e$B$"$k$s$@$C$?$iK\7o$O3d$H4JC1$K$J$j$^$9$h$M!#e(B

default_{internal,external,source}e$B$r%$%s%?%W%j%?5/F08e$KJQ99e(B
e$B$7$?$$$H$$$&OC$G$9$h$M!#$I$&$$$&6ILL$GI,MW$J$k$N$+$h$/$o$+$ie(B
e$B$J$+$C$?$N$G!"L5H?1~$@$C$?$o$1$G$9$,!#e(B

e$B$^$:e(Bsource encodinge$B$K$D$$$F$Oe(B

  • loade$B$Oe(Bmagic commente$B$rM}2r$7$^$9e(B
  • evale$B$O%=!<%9J8;zNs$Ne(Bencodinge$B$re(Bsource
    encodinge$B$H$7$F2r<ae(B
    e$B$9$k$N$G!"J8;zNs$Ne(Bencodinge$B$rE,@Z$K@_Dj$9$l$Pe(Bdefault
    source encodinge$B$r;XDj$9$kI,MW$O$J$$$N$G$Oe(B

e$B$H$9$k$H!“e(Bloade$B$Ge(Bmagic
commente$B$,$D$$$F$J$$%U%!%$%k$re(BUS-ASCII
e$B0J30$H$7$FFI$9~$$?$$$H$$$&$+$J$j%l%”%1!<%90J30$G$OFCJL$JBPe(B
e$B1~$OITMW$G$O$J$$$G$7$g$&$+!#$=$N$h$&$J%1!<%9$G$b%=!<%9$rFI$_e(B
e$B9~$s$Ge(Bencodinge$B$r@_Dj$7$Fe(Bevale$B$9$l$P$h$$$o$1$G$9$7!#e(B

e$B$G!“e(Bdefault
internale$B$He(Bexternale$B$r@Z$jBX$($k7o$G$9$,!“2~$a$F9Me(B
e$B$($F$_$k$H5v$7$F$b$h$$$h$&$J5$$,$7$^$9!#%”%W%j%1!<%7%g%sA4BNe(B
e$B$G6&DL$G$”$k$N$,$*9T57$,NI$$$H$O;W$$$^$9$,!“JQ99$G$-$J$$$3$He(B
e$B$r6/@)$7$J$/$F$O$J$i$J$$$[$I<Y0-$G$b$J$$$G$7$g$&!#$”$/$^$G$be(B
defaulte$B$J$N$G!#e(B

|e$B$3$NJU$j$b4^$a$F!"%G%U%)%k%H$N%(%s%3!<%G%#%s%0@_Dj$NJQ99$r5v$9$3$H$,8@8le(B
|e$B%G%6%$%sE*$K$"$jF@$k$N$+$I$&$+$^$D$b$H$5$s$K;G$$$?$$$G$9!#e(B
|e$B;d$O7k9=8=>u$KG<F@$7$F$^$9!#e(B

e$B$$$^$5$ie(BEncoding.default_external=e$B%a%=%C%I$J$I$rDI2C$9$k$H$$e(B
e$B$&$N$O$I$&$J$s$G$7$g$&$M!#e(B

e$B$"$H!“e(B-E us-ascii e$B$Ge(B default_internal e$B$,>!<j$Ke(B utf-8
e$B$K$J$ke(B
e$B$N$O$”$s$^$jNI$/$J$$$h$&$J5$$,$7$F$-$^$7$?!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#9

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

Yukihiro M. e$B$5$s$O=q$-$^$7$?e(B:

e$B9~$s$Ge(Bencodinge$B$r@_Dj$7$Fe(Bevale$B$9$l$P$h$$$o$1$G$9$7!#e(B
e$BLdBj$J$N$Oe(Birbe$B$de(Berbe$B$Ge(B-Ke$B$r;XDj$7$F!"$=$NCf$Ge(Bmagic
commente$B$NIU$$$F$$$J$$e(B
e$B%U%!%$%k$re(Bloade$B$9$k$H$$$&%l%"$J%1!<%9$@$1$G$9!#e(B

-Ke$B$O$b$H$b$He(B1.8e$B8_49@-$N$?$a$N$b$N$HM}2r$7$F$$$^$9$+$i!"e(Birbe$B$de(Berbe$B$G$O%5e(B
e$B%]!<%H$NI,MW$J$7$H$$$&$N$b#1$D$NA*Br;h$G$9!#0lJ}!"e(Birbe$B$,$G$-$k$@$1e(Brubye$B%3e(B
e$B%^%s%I$N$h$&$K?6$kIq$&$3$H$r4|BT$9$k$J$i$P!"e(Birbe$B$N$?$a$@$1$K$Oe(Bscript
encodinge$B$r@_Dj$G$-$J$$$H:$$j$^$9!#e(B

e$B$G$O;D$j$Ne(Bdefault_externale$B$He(Bdefault_internale$B$K$D$$$F!#e(B

e$B;d$O!"%G%U%)%k%H!“FC$Ke(Bdefault_internale$B$,5/F08e$KJQ2=$9$k$N$O4m81$@$H;W$Ce(B
e$B$F$^$9!#4{$K=R$Y$?$h$&$K3+$$$F$7$^$C$?%j%=!<%9$,$”$k$+$b$7$l$^$;$s$7!"%ie(B
e$B%$%V%i%j$K$`$d$_$K@Dj$7$FM$7$/$"$j$^$;$s!#e(B

e$B$?$@!“e(Birbe$B$N$h$&$K3N$+$K$=$l$rI,MW$H$9$k;vNc$,$”$k$o$1$G$9!#2f!9$NA[A|$Ne(B
e$B5Z$P$J$$;w$?$h$&$J%1!<%9$,B8:$9$k$+$b$7$l$^$;$s!#$@$+$i!"e(Bdefault
{internal,external}e$B$Ne(Bsettere$B$rIU$1$k$+$I$&$+$H8@$&$N$O!"$I$NDxEY!V<+J,$Ne(B
e$BB-$r7b$AH4$/<+M3!W$rG’$a$k$+$H$$$&LdBj$G$9!#e(B
e$BL^O@$^$D$b$H$5$s<!Bh$G$9$1$l$I$b!"G’$a$A$c$C$FNI$$$s$G$9$+e(B?

== e$B8=>ue(B

  • irb -K, erb -Ke$B$OI,MW$+e(B?
    YES => script encodinge$B$N@_DjJ}K!$,I,MWe(B(Rubye$B%l%Y%k$+e(BC
    APIe$B$+$OJLe(B)
    NO => e$BLdBj$J$7e(B

e$B%(%s%3!<%G%#%s%0$N%G%U%)%k%H$re(BRubye$B%l%Y%k$GJQ99$G$-$k$Y$-$+e(B?
YES => settere$B%a%=%C%IDI2C$G2r7he(B
NO => IRB.parse_optse$B$N3HD%%i%$%V%i%j2=$G2r7he(B

e$B$3$NH=CG$r$^$D$b$H$5$s$K$*4j$$$7$?$/;W$$$^$9!#e(B


#10

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37296] Re: m17n of irb”
on Sun, 7 Dec 2008 21:51:39 +0900, removed_email_address@domain.invalid
(e$B@PDM7=<ye(B) writes:

|>default_{internal,external,source}e$B$r%$%s%?%W%j%?5/F08e$KJQ99e(B
|>e$B$7$?$$$H$$$&OC$G$9$h$M!#$I$&$$$&6ILL$GI,MW$J$k$N$+$h$/$o$+$ie(B
|>e$B$J$+$C$?$N$G!"L5H?1~$@$C$?$o$1$G$9$,!#e(B
|
|rubye$B$Ge(Blinuxe$B%3%^%s%I$r:n@.$7$?>l9g$Oe(B, e$B%$%s%?%W%j%?5/F08e$K$7$+e(B,
|default_{internal,external,source} e$B$rJQ99$9$k$3$H$O$G$-$J$$$H;W$$$^$9e(B
|e$B$,e(B? e$B$^$"e(B, e$B4D6-JQ?t$de(B
|
|ruby -E… -S command
|
|e$B$G=PMh$J$/$b$J$$$G$9$,e(B, e$B$A$g$C$H4*J[$7$FM_$7$$$G$9e(B.

e$B$$$d!"$G$-$k!"$G$-$J$$$NOC$G$O$J$/$Fe(B(e$B8=>u$G$-$J$$$N$OEvA3G’<1e(B
e$B$7$F$$$^$9e(B)e$B!"$J$<$=$&$7$J$1$l$P$J$i$J$$$N$+$C$F$$$&OC$G$9!#e(B
irbe$B$H$$$&4D6-$G$G$-$J$/$F$b!"$*$+$7$/$O$J$$$G$9$h$M!#e(B


#11

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :37292 ] the message: "[ruby-dev:37292] Re: m17n of irb
", on Dec/07 02:59(JST) Yukihiro M. writes:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

default_{internal,external,source}e$B$r%$%s%?%W%j%?5/F08e$KJQ99e(B
e$B$7$?$$$H$$$&OC$G$9$h$M!#$I$&$$$&6ILL$GI,MW$J$k$N$+$h$/$o$+$ie(B
e$B$J$+$C$?$N$G!"L5H?1~$@$C$?$o$1$G$9$,!#e(B

rubye$B$Ge(Blinuxe$B%3%^%s%I$r:n@.$7$?>l9g$Oe(B,
e$B%$%s%?%W%j%?5/F08e$K$7$+e(B,
default_{internal,external,source}
e$B$rJQ99$9$k$3$H$O$G$-$J$$$H;W$$$^$9e(B
e$B$,e(B? e$B$^$"e(B, e$B4D6-JQ?t$de(B

ruby -E… -S command

e$B$G=PMh$J$/$b$J$$$G$9$,e(B, e$B$A$g$C$H4*J[$7$FM_$7$$$G$9e(B.

e$B9~$s$Ge(Bencodinge$B$r@_Dj$7$Fe(Bevale$B$9$l$P$h$$$o$1$G$9$7!#e(B
e$B$^$"e(B, e$B$=$&$J$s$G$9$,e(B…
IOe$B$H$+$be(Bopene$B$9$k$H$-$K;XDj$G$-$k$N$G$9$+$ie(B,
loade$B$Ge(B source encoding e$B$,;XDj$G$-$F$bNI$$5$$,$7$^$9e(B.

e$B$G!“e(Bdefault internale$B$He(Bexternale$B$r@Z$jBX$($k7o$G$9$,!“2~$a$F9Me(B
e$B$($F$_$k$H5v$7$F$b$h$$$h$&$J5$$,$7$^$9!#%”%W%j%1!<%7%g%sA4BNe(B
e$B$G6&DL$G$”$k$N$,$*9T57$,NI$$$H$O;W$$$^$9$,!“JQ99$G$-$J$$$3$He(B
e$B$r6/@)$7$J$/$F$O$J$i$J$$$[$I<Y0-$G$b$J$$$G$7$g$&!#$”$/$^$G$be(B
defaulte$B$J$N$G!#e(B

e$B;d$b<B$N$H$3$m$=$&;W$C$F$$$^$7$?e(B. rubye$B$G$Oe(B,
e$B$=$l0J>e$KI]$$$3$H$,4JC1$Ke(B
e$B$G$-$k$o$1$G$9$7e(B…

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—


#12

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37293] Re: m17n of irb”
on Sun, 7 Dec 2008 11:41:42 +0900, “Yugui (Yuki S.)”
removed_email_address@domain.invalid writes:

|e$BLdBj$J$N$Oe(Birbe$B$de(Berbe$B$Ge(B-Ke$B$r;XDj$7$F!"$=$NCf$Ge(Bmagic commente$B$NIU$$$F$$$J$$e(B
|e$B%U%!%$%k$re(Bloade$B$9$k$H$$$&%l%"$J%1!<%9$@$1$G$9!#e(B
|
|-Ke$B$O$b$H$b$He(B1.8e$B8_49@-$N$?$a$N$b$N$HM}2r$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EY!V<+J,$Ne(B
|e$BB-$r7b$AH4$/<+M3!W$rG’$a$k$+$H$$$&LdBj$G$9!#e(B
|e$BL^O@$^$D$b$H$5$s<!Bh$G$9$1$l$I$b!"G’$a$A$c$C$FNI$$$s$G$9$+e(B?

e$B%?%$%_%s%0E*$K%a%=%C%IA}$d$7$F$$$$$s$G$9$+!)e(B

|== e$B8=>ue(B
|* irb -K, erb -Ke$B$OI,MW$+e(B?
| YES => script encodinge$B$N@_DjJ}K!$,I,MWe(B(Rubye$B%l%Y%k$+e(BC APIe$B$+$OJLe(B)
| NO => e$BLdBj$J$7e(B

NOe$B!#8D?ME*$K$OLdBj$J$7$G$O$J$$$+$H;W$C$F$$$^$9!#e(B

|* e$B%(%s%3!<%G%#%s%0$N%G%U%)%k%H$re(BRubye$B%l%Y%k$GJQ99$G$-$k$Y$-$+e(B?
| YES => settere$B%a%=%C%IDI2C$G2r7he(B
| NO => IRB.parse_optse$B$N3HD%%i%$%V%i%j2=$G2r7he(B

YESe$B!#%j%j!<%9%^%M%8%a%s%HE*$K5v$5$l$k$N$G$"$l$Pe(Bsettere$B%a%=%C%Ie(B
e$B$NDI2C$,NI$$$N$G$O!#e(B


#13

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :37297 ] the message: "[ruby-dev:37297] Re: m17n of irb
", on Dec/07 23:34(JST) Yukihiro M. writes:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

irbe$B$H$$$&4D6-$G$G$-$J$/$F$b!"$*$+$7$/$O$J$$$G$9$h$M!#e(B
e$B$^$“e(B, e$B@Dj$G$-$k$h$&$K$J$k$$?$$$J$N$Ge(B,
e$B$”$^$j94$C$F$b$7$g$&$,$J$$$s$Ge(B
e$B$9$1$I$Me(B.

irbe$B$H$+4X78$J$7$NOC$G9M$($^$9e(B.

ruby -E… script-file

e$B$,$7$?$$;~$C$F$I$&$$$&;~$G$9e(B? e$B$=$l$,$7$?$$$H$-$,$"$k$J$ie(B,
script-file
e$B$re(B linux-command e$B$H$7$F;H$$$?$/$J$C$k>l9g$b$"$k$N$G$Oe(B?
e$B$H8@$&$3$H$,8@e(B
e$B$$$?$+$C$?$N$G$9e(B.

|e$B$^$"e(B, e$B$=$&$J$s$G$9$,e(B… IOe$B$H$+$be(Bopene$B$9$k$H$-$K;XDj$G$-$k$N$G$9$+$ie(B,
|loade$B$Ge(B source encoding e$B$,;XDj$G$-$F$bNI$$5$$,$7$^$9e(B.

e$B!V$G$-$F$bNI$$e(B(e$B$G$-$F$O$$$1$J$$$H$$$&$o$1$G$O$J$$e(B)e$B!W$N$+$b$7e(B
e$B$l$^$;$s$,!“I,MW$H$J$k%1!<%9$OLGB?$K$J$$e(B(e$BFC$Ke(B1.9e$B$G$Oe(B)e$B$H$b;W$&e(B
e$B$N$G!”@Q6KE*$K;?@.$O$7$^$;$s!#e(B

e$B$3$A$i$K4X$7$F$Oe(B, e$B;d$NJ}$O$=$l$[$I94$C$F$$$^$;$se(B.
e$B>>K$5$s$,8@$C$F$$$ke(B
e$B$h$&$Ke(B, e$BLnO:$H;W$($P$I$&$K$+=PMh$^$9$N$Ge(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—


#14

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

e$B$"!"$R$H$DJV;v$r$9$k$N$rK:$l$F$^$7$?!#e(B

In message “Re: [ruby-dev:37296] Re: m17n of irb”
on Sun, 7 Dec 2008 21:51:39 +0900, removed_email_address@domain.invalid
(e$B@PDM7=<ye(B) writes:

|e$B$^$"e(B, e$B$=$&$J$s$G$9$,e(B… IOe$B$H$+$be(Bopene$B$9$k$H$-$K;XDj$G$-$k$N$G$9$+$ie(B,
|loade$B$Ge(B source encoding e$B$,;XDj$G$-$F$bNI$$5$$,$7$^$9e(B.

e$B!V$G$-$F$bNI$$e(B(e$B$G$-$F$O$$$1$J$$$H$$$&$o$1$G$O$J$$e(B)e$B!W$N$+$b$7e(B
e$B$l$^$;$s$,!“I,MW$H$J$k%1!<%9$OLGB?$K$J$$e(B(e$BFC$Ke(B1.9e$B$G$Oe(B)e$B$H$b;W$&e(B
e$B$N$G!”@Q6KE*$K;?@.$O$7$^$;$s!#e(B


#15

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:37300] Re: m17n of irb”
on Mon, 8 Dec 2008 00:47:38 +0900, removed_email_address@domain.invalid
(e$B@PDM7=<ye(B) writes:

|ruby -E… script-file
|
|e$B$,$7$?$$;~$C$F$I$&$$$&;~$G$9e(B? e$B$=$l$,$7$?$$$H$-$,$"$k$J$ie(B, script-file
|e$B$re(B linux-command e$B$H$7$F;H$$$?$/$J$C$k>l9g$b$"$k$N$G$Oe(B? e$B$H8@$&$3$H$,8@e(B
|e$B$$$?$+$C$?$N$G$9e(B.

shbange$B$G$N;HMQ$r9M$($F$$$^$9!#$D$^$j!"$=$N%"%W%j%1!<%7%g%s$,e(B
e$B$I$N$h$&$J%(%s%3!<%G%#%s%0$GF~=PNO$7$?$$$+@k8@$9$k%$%a!<%8$Ge(B
e$B$9$M!#e(Birbe$B$O%"%W%j%1!<%7%g%s$rAv$i$;$kJlBN$G$O$J$$$N$G!"$=$&e(B
e$B$$$&$N$OITMW$G$O$J$$$+$H$$$&$N$,;d$NA[Dj$G$9!#e(B


#16

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :37301 ] the message: "[ruby-dev:37301] Re: m17n of irb
", on Dec/08 00:52(JST) Yukihiro M. writes:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

e$B7kO@=P$F$$$k$N$Ge(B, e$B$$$^$5$i$G$b$J$/$b$J$$$G$9$,e(B…

shbange$B$G$N;HMQ$r9M$($F$$$^$9!#$D$^$j!"$=$N%"%W%j%1!<%7%g%s$,e(B
e$B$I$N$h$&$J%(%s%3!<%G%#%s%0$GF~=PNO$7$?$$$+@k8@$9$k%$%a!<%8$Ge(B
e$B$9$M!#e(B

  • shbange$B$C$Fe(BWindowse$B$H$+$C$Fe(BOKe$B$J$s$G$9e(B?
  • shbang e$B$C$F0z?te(B1e$B$D$^$G$@$H;W$$$^$9e(B. env e$B$r;H$&$He(B
    rubye$B$K$O0z?tEO$;$^$;e(B
    e$B$se(B.

e$B$=$l$Ke(B,
e$B$3$NA0Ds$OF0E*$K$OJQ$($J$$$@$m$&$H$$$&$b$N$@$H;W$$$^$9$,e(B,
e$B30Ite(B
e$B%(%s%3!<%G%#%s%0$OF0E*$KJQ$($i$l$k$h$&$K$7$?$$$3$H$b$=$l$J$j$K$"$k$H;We(B
e$B$&$s$G$9$h$M$'e(B. e$BNc$($Pe(B, rubye$B$G:n$C$?e(Bgrepe$B$H$+e(B…
e$B$^$“e(B, e$B$=$&$$$C$?>l9g$Oe(B
default_external_encodinge$B;H$&$J$C$FOC$b$”$k$H$O;W$$$^$9$,e(B…

irbe$B$O%"%W%j%1!<%7%g%s$rAv$i$;$kJlBN$G$O$J$$$N$G!"$=$&e(B
e$B$$$&$N$OITMW$G$O$J$$$+$H$$$&$N$,;d$NA[Dj$G$9!#e(B

e$B$(!<$He(B. e$B$3$A$i$N0UL#$,NI$/J,$+$j$^$;$se(B…

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—


#17

e$B$J$+$@$G$9!#e(B

At Mon, 8 Dec 2008 11:05:23 +0900,
Yugui (Yuki S.) wrote in [ruby-dev:37302]:

e$BL^O@$3$N%?%$%_%s%0$GDI2C$7$?$/$J$$$s$G$9$,!"e(Birb -Ee$B$,$J$$$^$^%j%j!<%9$9$ke(B
e$B$h$j$^$7$@$H;W$C$F$$$^$9!#$^$?!"e(B1.9.1e$B$Ge(Bdefault_internal, externale$B$NITJQe(B
e$B@-$r2>Dj$7$?$^$^%W%m%0%i%`$,=q$+$l$Fe(B1.9.2e$B$GF0$+$J$/$J$k$h$j$O$^$7$@$He(B
e$B;W$C$F$$$^$9!#e(B
e$B0l1~D/$a$?HO0O$G$OITJQ@-$K0MB8$7$F$$$kE:IU%i%$%V%i%j$O$J$5$=$&$J$N$G1F6Ae(B
e$B$O:G>.$K$H$I$^$k$G$7$g$&!#e(B

default_internal, externale$B$K0MB8$9$k$h$&$J%i%$%V%i%j$,$=$b$=$b<Ye(B
e$B0-$J$N$G!“JQ99$G$-$k$h$&$K$7$Fe(Be$B$$$8$a$Fe(Be$B$”$V$j=P$7$F$de(B
e$B$k$[$&$,$$$$$H;W$$$^$9!#e(B


#18

Yukihiro M. e$B$5$s$O=q$-$^$7$?e(B:

|== e$B8=>ue(B
|* irb -K, erb -Ke$B$OI,MW$+e(B?
| YES => script encodinge$B$N@_DjJ}K!$,I,MWe(B(Rubye$B%l%Y%k$+e(BC APIe$B$+$OJLe(B)
| NO => e$BLdBj$J$7e(B

NOe$B!#8D?ME*$K$OLdBj$J$7$G$O$J$$$+$H;W$C$F$$$^$9!#e(B

e$BG<F@$7$^$7$?!#e(B

|* e$B%(%s%3!<%G%#%s%0$N%G%U%)%k%H$re(BRubye$B%l%Y%k$GJQ99$G$-$k$Y$-$+e(B?
| YES => settere$B%a%=%C%IDI2C$G2r7he(B
| NO => IRB.parse_optse$B$N3HD%%i%$%V%i%j2=$G2r7he(B

YESe$B!#%j%j!<%9%^%M%8%a%s%HE*$K5v$5$l$k$N$G$"$l$Pe(Bsettere$B%a%=%C%Ie(B
e$B$NDI2C$,NI$$$N$G$O!#e(B

e$BL^O@$3$N%?%$%_%s%0$GDI2C$7$?$/$J$$$s$G$9$,!"e(Birb
-Ee$B$,$J$$$^$^%j%j!<%9$9$ke(B
e$B$h$j$^$7$@$H;W$C$F$$$^$9!#$^$?!"e(B1.9.1e$B$Ge(Bdefault_internal,
externale$B$NITJQe(B
e$B@-$r2>Dj$7$?$^$^%W%m%0%i%`$,=q$+$l$Fe(B1.9.2e$B$GF0$+$J$/$J$k$h$j$O$^$7$@$He(B
e$B;W$C$F$$$^$9!#e(B
e$B0l1~D/$a$?HO0O$G$OITJQ@-$K0MB8$7$F$$$kE:IU%i%$%V%i%j$O$J$5$=$&$J$N$G1F6Ae(B
e$B$O:G>.$K$H$I$^$k$G$7$g$&!#e(B

e$B$^$D$b$H$5$s$NH=CG$bD:$-$^$7$?$7!"FC$K0[O@$,$J$1$l$Pe(Bsettere$B$re(Btrunke$B$He(B1.9.1
e$B$KDI2C$7$h$&$H;W$$$^$9!#$^$?!"e(Birce$B$G:{ED$5$s$HOC$7$^$7$F!V$;$a$Fe(Bwarninge$B$/e(B
e$B$i$$$O=P$9$,NI$+$m$&!W$H$$$&OC$K$J$j$^$7$?!#e(B


#19

In message removed_email_address@domain.invalid
on Mon, 8 Dec 2008 17:45:47 +0900,
Yukihiro M. removed_email_address@domain.invalid wrote:

Rubye$B$O<+NO$G2r@O$7$^$9!#e(B
e$B<+NO$G2r@O$9$k%W%i%C%H%U%)!<%`$Oe(BWindowse$B$G$NOC$G$7$g$&$+e(B?

e$B%7%9%F%`$K$h$j$^$9$,!“e(B”#!“e$B$r2r<a$7$F!”%$%s%?!<%W%j%?$H0z?t$K2r<a$7$Fe(B
e$B5/F0$9$k=hM}$O%+!<%M%k$G9T$$$^$9!#$=$3$G!"<B9T8"$N$"$k%U%!%$%ke(Bscripte$B$,e(B

#! command arg

e$B$@$He(B command e$B$Ke(B arg
e$B$rBhe(B1e$B0z?t!"85$N%9%/%j%W%H$rBhe(B2e$B0z?t$H$7$F5/F0$9$k$3e(B
e$B$H$K$J$j$^$9!#$3$N$?$a!"e(Barge$B$r%9%Z!<%9$G6h@Z$C$FJ#?tEO$7$?$D$b$j$G$b!"e(B

#! command a b c

commande$B$NBhe(B1e$B0z?t$K$Oe(B "a b c"e$B$H$7$FEO$j$^$9!#$3$N$?$a!"e(B

#! env ruby -v

e$B$H$+$9$k$H!"e(Benve$B$Oe(B “ruby -v”
e$B$H$$$&%W%m%0%i%`$r<B9T$7$h$&$H$7$F!"e(B

env: ruby -v: No such file or directory

e$B$H$J$C$F$7$^$$$^$9!#e(Brubye$B$,<+J,$G2r<a$9$k$h$j$bA0$K!“e(Brubye$B$re(Benve$B$,5/F0$Ge(B
e$B$-$^$;$s!#$&$^$/$$$/%7%9%F%`$b$”$k$N$+$b$7$l$^$;$s$,!"0J>e$Oe(B
NetBSD e$B>ee(B
e$B$G3NG’$7$F$$$^$9!#e(B

e$B$H!"$$$&OC$r@PDM$5$s$O8@$$$?$+$C$?$N$G$O$J$$$G$7$g$&$+e(B?

(e$B$b$C$H$b!"K$A$c$s$G$Oe(B shbang e$B$J9T$Ke(B env
e$B$J$s$F;H$C$A$c%@%a$@$H;W$&!#e(B)


#20

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :37307 ] the message: "[ruby-dev:37307] Re: m17n of irb
", on Dec/08 17:45(JST) Yukihiro M. writes:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

|* shbange$B$C$Fe(BWindowse$B$H$+$C$Fe(BOKe$B$J$s$G$9e(B?
|* shbang e$B$C$F0z?te(B1e$B$D$^$G$@$H;W$$$^$9e(B. env e$B$r;H$&$He(B rubye$B$K$O0z?tEO$;$^$;e(B
| e$B$se(B.

Rubye$B$O<+NO$G2r@O$7$^$9!#e(B

e$B=PMh$F$J$$$_$?$$$G$9$he(B?

#!/usr/local/bin/ruby -Eeuc-jp:utf-8 -Ke

e$B$N$H$-e(B,

/usr/local/bin/ruby: unknown encoding name - utf-8 -Ke (RuntimeError)

e$B$C$F%(%i!<$,=P$^$9e(B. e$B$^$?e(B,

#!/usr/local/bin/ruby -Ke -Eeuc-jp:utf-8

e$B$@$He(B,

/usr/local/bin/ruby: invalid option - (-h will show valid options)
(RuntimeError)

e$B$H$J$j$^$9e(B.

e$B$^$"e(B, e$B$3$l$O$J$*$k5$$,$7$^$9$,e(B…

enve$B$r;H$&$He(B,
enve$B<+?H$K%%W%7%g%s$,e(B1e$B$D$NJ8;zNs$H$7$FEO$5$l$k$N$Ge(B, ruby
e$B$N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B$I@5$7$$$H$b8@$($J$$$H;W$$$^$9$,e(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—