Binary String

In article [email protected],
Hidetoshi NAGAI [email protected] writes:

e$B!VLr$KN)$?$J$$!W$H$$$&$N$O!$e(B
Ruby/Tk e$B$K$*$1$ke(B encoding e$B$N<+F0JQ49=hM}$G$Ne(B
e$BH=Dj$K:]$7$F$G$9e(B ([ruby-dev:32550])e$B!%e(B

ASCII-8BIT e$B$O$"$^$j?.Mj$G$-$ke(B encoding e$B$G$O$J$$$G$9$h$M!)e(B
encoding e$B$rL@3N$K;XDj$7$F$$$J$1$l$P4JC1$Ke(B ASCII-8BIT e$B$Ke(B
e$B$J$C$F$7$^$$$^$9!%e(B

e$B4pK\J}?K$H$7$F!"e(BASCII e$B$G$J$$J8;zNs$re(B ASCII-8BIT
e$B$G07$&$N$ONce(B
e$B30E*$J>u67$K$J$k$Y$-$G$9!#e(B

e$B%^%k%A%P%$%HJ8;z$r4^$$b$N$re(B ASCII-8BIT e$B$G07$&$H!"J8;zC10L$Ne(B e$BA:n$,$G$-$^$;$s$+$i!“e(BString e$B$N%a%=%C%I$NF0:n$K$b;Y>c$rMh$7e(B
e$B$^$9!#e(Bencoding e$B$rE,@Z$KIU$1$J$$$3$H$NLdBj$Oe(B tk
e$B$@$1$NLdBj$Ge(B
e$B$O$”$j$^$;$s!#e(B

e$B$G$9$+$i!"2DG=$J8B$jE,@Z$Je(B encoding e$B$r;XDj$9$Y$-$G$9!#e(B

e$B$=$7$F!“E,@Z$Je(B encoding e$B$r;XDj$9$k$3$H$,:$Fq$G$”$k$J$i!“$=$Ne(B
e$B:$Fq$5$r=|5n$9$k;Y1g$r9T$&$3$H$r$^$:Bh0l$K9M$($k$Y$-$G$9!#$=e(B
e$B$l$r=<J,$K9M$($?7k2L!”$=$l$,L5M}$G$“$k$H3N?.$,;}$F$?;~$K!”$Oe(B
e$B$8$a$F0c$&7A$N;Y1ge(B (e$BNc$($Pe(BBINARY
e$B$NF3F~$H$+e(B)e$B$r9M$($k$Y$-$G$7$ge(B
e$B$&!#e(B

e$B$=$7$F!"8=:_$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ASCIIe$BJ8;zNs$K9-$/MQ$k$N$O0U?^$5$l$F$$$^$;$s!#e(B
e$B9-$/MQ$$$i$l$F$7$^$&$3$H$rHr$1$kJ}8~$X$$$/$N$OIT2DG=$@$H9M$(e(B
e$B$F$$$^$9$+e(B?

ASCII-8BIT e$B$Ne(B replica e$B$H$$$&$3$H$K$7$F$$1$P!$e(B
e$B0JA0$K$
$C$7$c$i$l$?e(B binary string e$B$N%F%-%9%H=hM}$H$$$&E@$G$be(B
e$BLdBj$O$J$$$H;W$$$^$9!%e(B

ASCII-8BIT e$B$r;H$C$F$/$@$5$$!#e(B

e$B$=$l$G$b%@%a$G$7$g$&$+!)e(B

ASCII-8BIT e$B$,Hse(B ASCII e$BJ8;zNs$KBP$7$F9-$/;H$o$l$6$k$rF@$J$$$He(B
e$B$$$&E@$K4X$9$k@bF@NO$K7g$1$F$$$^$9!#$=$N$?$a!“;d$O$$$^$N$H$3e(B
e$B$me(BBINARY e$B$,I,MW$G$”$k$H$O;W$$$^$;$s!#e(B

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

Hidetoshi NAGAI wrote:

e$B$K$J$C$F$$$k$J$i$P!"$=$l$O%P%$%J%j%G!<%?$@$HH=CG$9$Y$-$G$7$g$&!#e(B

e$BHsBP1~e(B locale e$B$@$C$?$j$7$?>l9g$K$Oe(B default_external e$B$Oe(B ASCII-8BIT e$B$Ke(B
e$B$J$C$F$7$^$&$N$G$O$J$+$C$?$G$7$g$&$+!)e(B

e$B8=:_$OHsBP1~e(B locale
e$B$@$i$1$G$9$,!“0lHL$N;HMQ$K6!$;$k:”$K$O$[$\LdBj$J$/e(B
e$B$J$C$F$$$k$O$:$G$9!#e(B

e$B@h$N%a!<%k$G$O!Ve(Bdefault_external e$B$G!W$H$O=q$-$^$7$?$,!$e(B
Ruby e$BB&$,ITL@3N$J>l9g$K$O!$e(BTcl/Tk e$BB&$Ne(B encoding_system e$B$re(B
e$B;H$&$h$&$K$7$F$$$^$9!%e(B

e$B$^$@e(B Ruby e$BB&$He(B Tcl/Tk e$BB&$Ne(B encoding e$BL>$NBP1~$O$G$-$F$$$^$;$s$,!%e(B

e$B$=$&$7$?%1!<%9$Ge(B Ruby e$B>e$G$9$Y$Fe(B ASCII-8BIT e$B$K$5$l$F$7$^$&$He(B
e$B$I$&$7$h$&$b$"$j$^$;$s!%e(B

e$B>e$rA0Ds$K$9$k$H!"%F%-%9%H$G$"$k$N$K$b$+$+$o$i$:e(B ASCII-8BIT
e$B$r;XDj$5$l$?e(B
e$BJ8;z$,e(B Tcl/Tk
e$B$KEO$C$F$7$^$&$3$H$=$l<+BN$,LdBj$+$H$*$b$$$^$9!#e(BRuby 1.9
e$B$G$Oe(B string
e$B$r?dB,$GJ8;z%3!<%I<+F0JQ49$H$$$&9M$(<+BN$,4V0c$C$F$$$^$9$7!"e(B
e$B$=$N$h$&$J>u67$O>eN.$GKI$0$Y$-$G$7$g$&!#e(B

e$B7k6IEDCf$5$s$Ne(B [ruby-dev:33027]
e$B$H<q;]$OF1$8$J$N$G$9$,!“e(B"BINARY” e$B$,e(B
ASCII-8BIT e$B$Ne(B alias e$B$G$"$k$3$H$+$i$b!"%F%-%9%H$re(B ASCII-8BIT
e$B$N$^$^EO$9$Ne(B
e$B$,4V0c$$$G$9!#e(B

e$B!V8F$S=P$5$l$k%a%=%C%IB&$GH=CG$7$m!W$G$J$/!"e(B

e$B!V8F$S=P$9%a%=%C%IB&$,e(B encoding e$B$r$D$1$m!W$G$9$M!#e(B

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

Yukihiro M. wrote:

e$B$?$@!“e(Bdefault_externale$B$,e(BASCII-8BITe$B$K$J$C$F$7$^$&%1!<%9$,$I$&e(B
e$B$7$F$b$”$j$^$9$M!#$=$NJU$r?4G[$7$F$*$i$l$k$N$G$7$g$&$+!#e(B

e$B$`$7$me(B default_external
e$B$NLdBj$@$HB*$($k$Y$-$J$N$G$9$+$M!#e(BASCII-8BIT e$B$Ge(B
e$B$J$/e(B locale_charset e$B$Ge(B dummy encoding
e$B$r%;%C%H$7$?J}$,$$$$$H$+!#$=$l$bHye(B
e$BL/$@$J$!!#e(B

e$B$H$O$$$(!"8=:_$N54<V$,BP1~$7$F$$$J$$Id9f2=J}<0$C$Fe(B ISO 2022
e$B$/$i$$$7$+;We(B
e$B$$$D$+$J$$$N$G!"E,@Z$Ke(B replica
e$B$r:n$l$P$[$H$s$I$N>l9g2?$H$+$J$k$H;W$&$Ne(B
e$B$G$9$h$M!#e(B

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

In message “Re: [ruby-dev:33027] Re: Binary String”
on Fri, 11 Jan 2008 19:10:52 +0900, Tanaka A. [email protected]
writes:

|e$B30$+$iJ8;zNs$H$7$FFI$_9~$s$@$b$N$Oe(B default_external e$B$K$J$C$Fe(B
|e$B$$$k$O$:$G$9!#e(B
|
|e$B$K$b$+$+$o$i$:$=$&$J$C$F$$$J$$$N$O%P%$%J%j$G$7$g$&!#e(B

e$B$?$@!“e(Bdefault_externale$B$,e(BASCII-8BITe$B$K$J$C$F$7$^$&%1!<%9$,$I$&e(B
e$B$7$F$b$”$j$^$9$M!#$=$NJU$r?4G[$7$F$*$i$l$k$N$G$7$g$&$+!#e(B

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

In message “Re: [ruby-dev:33031] Re: Binary String”
on Fri, 11 Jan 2008 19:42:23 +0900, “NARUSE, Yui”
[email protected] writes:

|> e$B$?$@!“e(Bdefault_externale$B$,e(BASCII-8BITe$B$K$J$C$F$7$^$&%1!<%9$,$I$&e(B
|> e$B$7$F$b$”$j$^$9$M!#$=$NJU$r?4G[$7$F$$i$l$k$N$G$7$g$&$+!#e(B
|
|e$B$`$7$me(B default_external e$B$NLdBj$@$HB
$($k$Y$-$J$N$G$9$+$M!#e(BASCII-8BIT e$B$Ge(B
|e$B$J$/e(B locale_charset e$B$Ge(B dummy encoding e$B$r%;%C%H$7$?J}$,$$$$$H$+!#$=$l$bHye(B
|e$BL/$@$J$!!#e(B

e$B$=$NJ}8~$GBP1~$G$-$k$J$i!"$=$A$i$,M}A[$@$H;W$$$^$9!#$H$3$m$Ge(B

LANG=“C”

e$B$Ne(Bdefault_externale$B$Oe(BUS-ASCIIe$B$J$s$G$9$+$M$(!#e(B

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

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

Yukihiro M. wrote:

|e$BL/$@$J$!!#e(B

e$B$=$NJ}8~$GBP1~$G$-$k$J$i!"$=$A$i$,M}A[$@$H;W$$$^$9!#$H$3$m$Ge(B

LANG=“C”

e$B$Ne(Bdefault_externale$B$Oe(BUS-ASCIIe$B$J$s$G$9$+$M$(!#e(B

e$B$&$&$s!"$I$&$J$s$@$m$&$HLB$C$Fe(BSUSv3e$B$r8+$?$H$3$m!"!He(BThe
tables in Locale
Definition describe the characteristics and behavior of the POSIX locale
for data consisting entirely of characters from the portable character
set and the control character set. For other characters, the behavior is
unspecified.e$B!I$H$N$3$H!#$D$^$j!“e(BASCII + e$BL$Dj5Ae(B 8BIT
e$B$J$N$G!”$^$5$Ke(B
ASCII-8BIT e$B$N$3$H$J5$$,$7$^$9!#e(B

e$B$A$c$s$H%;%C%H$7$F$h!"$H$$$&J}8~$G$9$+$M$’!#e(B

e$BM73Z0C$H?=$7$^$9!#e(B
e$B2#$+$i8}$r64$s$G?=$7Lu$J$$$N$G$9$,!"e(B
e$B1J0f$5$sE*$K$O!"L>A0$H$7$F!Ve(Bbinarye$B!W$H$$$&L>A0$N%(%s%3!<%G%#%s%0$,e(B
e$B;H$($l$P$=$l$G$*$C$1!<$H$$$&Iw$KM}2r$7$?$N$G$9$,!#e(B

[ruby-dev:33018] e$B$Ne(B

e$B8=>u!$e(Bforce_encoding(‘binary’) e$B$J$I$O<u$1IU$1$F$O$/$l$^$9$,!$e(B
encoding e$B$O7k6Ie(B ASCII-8BIT e$B$H$J$C$F$7$^$&$N$G6hJL$,$G$-$:Lr$KN)$A$^$;$s!%e(B
e$B$G$9$N$G!$e(B

e$B$H$$$&H/8@$+$i9M$($F!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$$$s$8$c$J$$$G$7$g$&$+!#e(B

e$B$=$NEXNO$,BgJQ2a$.$k$H$+!“IT2DG=$G$”$k$H$+$H$$$&$3$H$K$J$l$P!"e(B
e$BJL$N<jCJ$r9M$($k$3$H$K$J$j$^$9$,!"8=:_$N$H$3$m$=$&$O9M$($F$$e(B
e$B$^$;$s!#e(B

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

Tanaka A. wrote:

e$B0c$&$h$&$K$7$?$$$s$G$9$+e(B?
e$B$o$?$7$O!He(BFor other characters, the behavior is
unspecified.e$B!I$r$I$&2r<a$9e(B
e$B$k$+!#6qBNE*$K$Oe(B LANG=C e$B$N;~$Ke(B “\x80”.valid_encoding?
e$B$,e(B true e$B$rJV$9$Y$-e(B
e$B$+e(B false e$B$rJV$9$Y$-$+$G!"e(Btrue
e$B$NJ}$,9%$^$7$$$N$+$J$!$H;W$C$F$$$?$N$G$9e(B
e$B$,!"e(Blocale_charmap e$B$,e(B ANSI_X3.4-1968 e$B$J$iJ86g$J$7$Ke(B
US-ASCII e$B$G$9$M!#e(B

In article [email protected],
“NARUSE, Yui” [email protected] writes:

e$B$o$?$7$O!He(BFor other characters, the behavior is unspecified.e$B!I$r$I$&2r<a$9e(B
e$B$k$+!#6qBNE*$K$Oe(B LANG=C e$B$N;~$Ke(B “\x80”.valid_encoding? e$B$,e(B true e$B$rJV$9$Y$-e(B
e$B$+e(B false e$B$rJV$9$Y$-$+$G!"e(Btrue e$B$NJ}$,9%$^$7$$$N$+$J$!$H;W$C$F$$$?$N$G$9e(B
e$B$,!"e(Blocale_charmap e$B$,e(B ANSI_X3.4-1968 e$B$J$iJ86g$J$7$Ke(B US-ASCII e$B$G$9$M!#e(B

e$B$=$&$$$($P!“e(BLANG=C e$B$Ge(B Encoding.locale_charmap e$B$,e(B
“US-ASCII”
e$B$K$J$k<BAu$b$”$j$^$9!#$3$l$re(B US-ASCII e$B0J30$K$9$k$N$O$J$+$J$+e(B
e$BFq$7$$$G$7$g$&!#e(B

e$B$A$J$_$Ke(B MacOS X e$B$G$9!#e(B

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

In message “Re: [ruby-dev:33037] Re: Binary String”
on Fri, 11 Jan 2008 21:41:53 +0900, Tanaka A. [email protected]
writes:

|> LANG=“C”
|>
|> e$B$Ne(Bdefault_externale$B$Oe(BUS-ASCIIe$B$J$s$G$9$+$M$(!#e(B
|
|LANG=C locale charmap e$B$Ge(B ANSI_X3.4-1968 e$B$,5"$C$F$/$k$h$&$J<Be(B
|e$BAu$G$Oe(B US-ASCII e$B$J$s$8$c$J$$$G$7$g$&$+!#e(B
|
|e$B0c$&$h$&$K$7$?$$$s$G$9$+e(B?

e$B$$$(!“0c$&$h$&$K$7$?$$$o$1$8$c$J$$$s$G$9!#1J0f$5$s$NN)>l$G9Me(B
e$B$($k$H!”%F%-%9%H$J$N$K%(%s%3!<%G%#%s%0$,e(BASCII-8BITe$B$Ge(BBINARYe$B$He(B
e$B6hJL$D$+$J$$J8;zNs$NB8:_$OK>$^$7$/$J$$$o$1$G!“$=$&$$$&%1!<%9e(B
e$B$O$”$k$N$+$I$&$+$H9M$($F$$$k$o$1$G$9!#e(B

e$B$“$H!”;W$$$D$/$N$Oe(B

  • script encodinge$B$,;XDj$5$l$J$+$C$?;~$Ne(BASCII-8BIT
  • e$BJ8;zNs$r9=@.$9$k%P%$%H$,$9$Y$Fe(B7bite$B$N;~$Ne(BASCII-8BIT

e$B$/$i$$$G$9$M!#$3$&9M$($k$H$3$l$i$b$^$:$$$h$&$J5$$,$7$^$9$M!#e(B

In article [email protected],
Yukihiro M. [email protected] writes:

LANG=“C”

e$B$Ne(Bdefault_externale$B$Oe(BUS-ASCIIe$B$J$s$G$9$+$M$(!#e(B

LANG=C locale charmap e$B$Ge(B ANSI_X3.4-1968 e$B$,5"$C$F$/$k$h$&$J<Be(B
e$BAu$G$Oe(B US-ASCII e$B$J$s$8$c$J$$$G$7$g$&$+!#e(B

e$B0c$&$h$&$K$7$?$$$s$G$9$+e(B?

e$B1J0f!wCNG=!%6e9)Bg$G$9!%e(B

From: Tanaka A. [email protected]
Subject: [ruby-dev:33027] Re: Binary String
Date: Fri, 11 Jan 2008 19:10:52 +0900
Message-ID: [email protected]

e$B4pK\J}?K$H$7$F!"e(BASCII e$B$G$J$$J8;zNs$re(B ASCII-8BIT e$B$G07$&$N$ONce(B
e$B30E*$J>u67$K$J$k$Y$-$G$9!#e(B

e$B%^%k%A%P%$%HJ8;z$r4^$$b$N$re(B ASCII-8BIT e$B$G07$&$H!"J8;zC10L$Ne(B e$BA:n$,$G$-$^$;$s$+$i!“e(BString e$B$N%a%=%C%I$NF0:n$K$b;Y>c$rMh$7e(B
e$B$^$9!#e(Bencoding e$B$rE,@Z$KIU$1$J$$$3$H$NLdBj$Oe(B tk e$B$@$1$NLdBj$Ge(B
e$B$O$”$j$^$;$s!#e(B

e$B$G$9$+$i!"2DG=$J8B$jE,@Z$Je(B encoding e$B$r;XDj$9$Y$-$G$9!#e(B

e$B$G$“$k$J$i!$e(Bbyte sequence e$B$G$O$J$$e(B String e$B$K$Oe(B
ASCII-8BIT e$B$,IUM?$5$l$F$O$J$i$J$$$N$G$O$J$$$G$7$g$&$+!%e(B
e$B$=$N>l9g!$L$CN$N$b$N$Ke(B Ruby e$B$,>!<j$KIUM?$9$k$J$i!$e(B
UNKNOWN-8BIT e$B$J$I$K$7$F$b$i$o$J$$$H:$$j$^$9!%e(B
Ruby e$B$K$h$C$Fe(B ASCII-8BIT
e$B$,>!<j$KIUM?$5$l$k2DG=@-$,$”$k8B$j!$e(B
ASCII-8BIT e$B$r?.Mj$7$F;H$&$3$H$O$G$-$^$;$s!%e(B

e$B8@$$49$($k$H!$e(BRuby/Tk e$B$G$O!$8=>u$Ge(B ASCII-8BIT
e$B$H$J$C$F$$$k>l9g$Oe(B
e$B>e$G8@$&e(B UNKNOWN-8BIT e$B$H9M$($F07$*$&$H$7$F$$$^$9!%e(B

e$B$A$J$_$K!“e(Bencoding e$B$de(B alias e$B$rA}$d$9I,MW$O$”$k$H;W$C$F$$$^$9!#e(B
(ANSI_X3.4-1968 e$B$H$+e(B)

e$BITB-$,B8:_$7$J$/$J$l$Pe(B ASCII-8BIT
e$B$,>!<j$KIUM?$5$l$k$3$H$O$J$$$N$J$ie(B
e$B$=$l$O$=$l$G!V$“$j!W$J$N$+$b$7$l$^$;$s$,!$e(B
e$B$=$l$,ITB-$7$F$$$k4V$O$I$&$J$k$N$G$7$g$&$+!)e(B
e$B:#8e?7$?$Je(B encoding
e$B$,A}2C$9$k$3$H$O$J$$$H$$$&J]>Z$O$”$k$N$G$7$g$&$+!)e(B
e$B$"$k$$$O!$A}2C$7$?>l9g$OCYBZ$J$/e(B encoding e$B$,DI2C$5$l$k$J$I$He(B
e$BJ]>Z$9$k$3$H$,$G$-$k$N$G$7$g$&$+!)e(B

e$B30$+$iJ8;zNs$H$7$FFI$_9~$s$@$b$N$Oe(B default_external e$B$K$J$C$Fe(B
e$B$$$k$O$:$G$9!#e(B

e$B$K$b$+$+$o$i$:$=$&$J$C$F$$$J$$$N$O%P%$%J%j$G$7$g$&!#e(B

e$B8=>u$G$Oe(B

$ echo $LANG
ja_JP.eucJP
$ ruby19 -v
ruby 1.9.0 (2008-01-10 revision 0) [i686-linux]
$ ruby19 -e ‘a = “aaa”; e = “e$B4A;ze(B”; p [a.encoding, e.encoding,
Encoding.default_external]’
[#Encoding:ASCII-8BIT, #Encoding:ASCII-8BIT, #Encoding:EUC-JP]

e$B$H$$$&$3$H$K$J$j$^$9$,!$$3$l$O8=>u$,4V0c$C$F$$$k$H$$$&$3$H$G$7$g$&$+!)e(B

ASCII-8BIT e$B$rHse(BASCIIe$BJ8;zNs$K9-$/MQ$k$N$O0U?^$5$l$F$$$^$;$s!#e(B
e$B9-$/MQ$$$i$l$F$7$^$&$3$H$rHr$1$kJ}8~$X$$$/$N$OIT2DG=$@$H9M$(e(B
e$B$F$$$^$9$+e(B?

Ruby e$B$,>!<j$KIUM?$9$k2DG=@-$,$"$k8B$j$OIT2DG=$@$H9M$($F$$$^$9!%e(B

ASCII-8BIT e$B$r;H$C$F$/$@$5$$!#e(B

e$B;DG0$J$,$i!$>e5-$N8=>u$r8+$k8B$j!$?.Mj$9$k$3$H$,$G$-$^$;$s!%e(B

e$B1J0f!wCNG=!%6e9)Bg$G$9!%e(B

From: Yukihiro M. [email protected]
Subject: [ruby-dev:33028] Re: Binary String
Date: Fri, 11 Jan 2008 19:27:40 +0900
Message-ID: [email protected]

e$B$?$@!“e(Bdefault_externale$B$,e(BASCII-8BITe$B$K$J$C$F$7$^$&%1!<%9$,$I$&e(B
e$B$7$F$b$”$j$^$9$M!#$=$NJU$r?4G[$7$F$*$i$l$k$N$G$7$g$&$+!#e(B

e$B$=$&$G$9$M!%e(B
e$B>!<j$K?dB,$5$l$?$b$N$HL@<($5$l$?$b$N$H$N6hJL$,$G$-$J$$$N$,?I$$$G$9!%e(B

e$B1J0f!wCNG=!%6e9)Bg$G$9!%e(B

From: “NARUSE, Yui” [email protected]
Subject: [ruby-dev:33029] Re: Binary String
Date: Fri, 11 Jan 2008 19:28:26 +0900
Message-ID: [email protected]

e$BHsBP1~e(B locale e$B$@$C$?$j$7$?>l9g$K$Oe(B default_external e$B$Oe(B ASCII-8BIT e$B$Ke(B
e$B$J$C$F$7$^$&$N$G$O$J$+$C$?$G$7$g$&$+!)e(B

e$B8=:_$OHsBP1~e(B locale e$B$@$i$1$G$9$,!“0lHL$N;HMQ$K6!$;$k:”$K$O$[$\LdBj$J$/e(B
e$B$J$C$F$$$k$O$:$G$9!#e(B

e$B$G$O!$$=$l$^$G$N4V$O$I$&$9$l$P$$$$$N$G$7$g$&!)e(B(^_^;
e$B$^$?!V$[$!W0J30$NItJ,$O$I$&$J$k$N$G$7$g$&$+!)e(B
e$B$=$3$Ge(B ASCII-8BIT e$B$,;H$o$l$F$7$^$&$N$G$O:$$j$^$9!%e(B

e$B7k6IEDCf$5$s$Ne(B [ruby-dev:33027] e$B$H<q;]$OF1$8$J$N$G$9$,!“e(B"BINARY” e$B$,e(B
ASCII-8BIT e$B$Ne(B alias e$B$G$“$k$3$H$+$i$b!”%F%-%9%H$re(B ASCII-8BIT e$B$N$^$^EO$9$Ne(B
e$B$,4V0c$$$G$9!#e(B

BINARY e$B$Ke(B ASCII-8BIT e$B$r;H$($H$$$&$N$G$"$l$P!$e(B
e$BL$CN$N$b$N$K>!<j$Ke(B ASCII-8BIT e$B$HIU$1$J$$$GM_$7$$$H;W$$$^$9!%e(B

e$B!V8F$S=P$5$l$k%a%=%C%IB&$GH=CG$7$m!W$G$J$/!"e(B

e$B!V8F$S=P$9%a%=%C%IB&$,e(B encoding e$B$r$D$1$m!W$G$9$M!#e(B

e$BJL%a!<%k$G$Ne(B one liner e$B$N$h$&$K!$e(B
locale e$B$K=>$C$?%G%U%)%k%H$Ne(B encoding e$B$G;H$*$&$H$7$F$$$k$N$Ke(B
e$BKhEYe(B encoding e$B$rL@<($7$J$1$l$P$J$i$J$$$H$$$&$N$O9s$G$9!%e(B
e$B%G%U%)%k%H$r;H$o$J$$>l9g$K$N$_e(B encoding
e$B;XDj$,I,MW$K$J$k$H$$$&$N$,e(B
e$B9%$^$7$$;Q$G$O$J$$$G$7$g$&$+!%e(B

e$B1J0f!wCNG=!%6e9)Bg$G$9!%e(B

From: “NARUSE, Yui” [email protected]
Subject: [ruby-dev:33035] Re: Binary String
Date: Fri, 11 Jan 2008 21:36:01 +0900
Message-ID: [email protected]

e$B$($'!"1J0f$5$s$NLdBj$Oe(B BINARY e$B$re(B ASCII-8BIT e$B$Ne(B alias e$B$G$J$/!"e(Breplica e$B$Ke(B
e$B$9$l$PBP:v2DG=$@$H;W$$$^$9!#e(B

e$B$O$$!%$=$N0F$,e(B [ruby-dev:33018] e$B$G$9$h$Me(B

e$B$7$+$7!“$=$b$=$bB>$N%F%-%9%H%G!<%?$,e(B ASCII-8BIT e$B$GN.$l$F$-$F$$$k$3$H$,$`e(B
e$B$7$mLdBj$J$N$G$O$J$$$+!#e(BBINARY e$B$rJL$KMQ0U$9$k$3$H$G!”$=$N$h$&$J$b$C$H=Ee(B
e$BMW$JLdBj$,J|CV$5$l$F$7$^$&$N$G$O$J$$$+!"$H$$$&$N$,e(B BINARY e$BF3F~$K>C6KE*$Je(B
e$BM}M3$K$J$j$^$9!#e(B

e$B$3$l$Oe(B ASCII-8BIT
e$B$r!VL$Dj5A!W>uBV$H8+$J$7$F$$$k$H$$$&$3$H$G$9$h$M!)e(B
e$B$h$/$o$+$i$J$$$N$G$9$,!$e(BBINARY
e$B$G!VDj5A!W$7$?$$$H$$$&4uK>$KBP$7$Fe(B
e$B!VL$Dj5A!W$rI=$7$F$$$ke(B ASCII-8BIT
e$B$r;H$($H8@$C$F$$$k$3$H$K$J$j$^$;$s$+!)e(B

e$B$J$N$Ge(B ASCII-8BIT e$B$OL$Dj5A!“e(BBINARY e$B$O%P%$%J%j%G!<%?$HJ,$1$k$H$$$&J}K!$be(B
e$B$”$k$N$G$7$g$&$,!“F1$8$K$7$FLdBj$K5$IU$-$d$9$/$7$?J}$,D94|E*$K8+$l$PBEEve(B
e$B$G$”$m$&$H$NH=CG$G$9!#e(B

e$BL@<($HHsL@<($H$N6hJL$,$G$-$J$$>u67$G!$e(B
e$B!VF1$8$K$7$FLdBj$K5$IU$-$d$9$/!W$H$$C$7$c$i$l$F$b!%!%!%e(B(^_^;
e$BL$Dj5A$,H=JL2DG=$K$7$F$
$/$N$,6Z$G$O$J$$$+$H!%e(B

e$B1J0f!wCNG=!%6e9)Bg$G$9!%e(B

From: Tanaka A. [email protected]
Subject: [ruby-dev:33036] Re: Binary String
Date: Fri, 11 Jan 2008 21:38:35 +0900
Message-ID: [email protected]

encoding e$B$r@5$7$/@_Dj$9$k$H$$$&$N$OJ8;z$rJ8;z$H$7$F07$&4pACe(B
e$B$J$N$G!"e(Btk e$B$NLdBj$,2r7h$7$?$H$7$F$b!"B>$G$NLdBj$,;D$j$^$9!#e(B

tk e$B$@$1$G$J$/!"B>$NLdBj$b0lEY$K2r7h$G$-$kJ}8~$G?J$a$k$h$&EXe(B
e$BNO$9$k$[$&$,$$$$$s$8$c$J$$$G$7$g$&$+!#e(B

e$B$=$NEXNO$,BgJQ2a$.$k$H$+!“IT2DG=$G$”$k$H$+$H$$$&$3$H$K$J$l$P!"e(B
e$BJL$N<jCJ$r9M$($k$3$H$K$J$j$^$9$,!"8=:_$N$H$3$m$=$&$O9M$($F$$e(B
e$B$^$;$s!#e(B

e$B;d$H$7$F$O!$e(B

  • ASCII-8BIT e$B$He(B BINARY e$B$H$NAH9g$o$;$Ge(B BINARY
    e$B$G$"$k$3$H$rL@<(2DG=e(B

e$B$H$+e(B

e$B!ve(BASCII-8BIT e$B$He(B UNKNOWN-8BIT e$B$H$NAH9g$o$;$G!$e(B
e$BL@<($5$l$?>l9g$K$N$_e(B ASCII-8BIT

e$B$H$+$G!$L@<($HL$CN$H$N6hJL$,$G$-$5$($9$l$Pe(B
e$B<u$1F~$l$k$3$H$,$G$-$k$N$G$9$,!%!%!%e(B

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

e$B$^$:!“;d$Oe(BBINARYe$B$NF3F~$KH?BP$7$F$$$k$o$1$G$O$”$j$^$;$s!"$HL@e(B
e$B<($7$F$*$/!#e(B

In message “Re: [ruby-dev:33041] Re: Binary String”
on Sat, 12 Jan 2008 00:47:43 +0900, Hidetoshi NAGAI
[email protected] writes:

|> e$B$A$J$$K!“e(Bencoding e$B$de(B alias e$B$rA}$d$9I,MW$O$”$k$H;W$C$F$$$^$9!#e(B
|> (ANSI_X3.4-1968 e$B$H$+e(B)
|
|e$BITB-$,B8:
$7$J$/$J$l$Pe(B ASCII-8BIT e$B$,>!<j$KIUM?$5$l$k$3$H$O$J$$$N$J$ie(B
|e$B$=$l$O$=$l$G!V$“$j!W$J$N$+$b$7$l$^$;$s$,!$e(B
|e$B$=$l$,ITB-$7$F$$$k4V$O$I$&$J$k$N$G$7$g$&$+!)e(B
|e$B:#8e?7$?$Je(B encoding e$B$,A}2C$9$k$3$H$O$J$$$H$$$&J]>Z$O$”$k$N$G$7$g$&$+!)e(B
|e$B$"$k$$$O!$A}2C$7$?>l9g$OCYBZ$J$/e(B encoding e$B$,DI2C$5$l$k$J$I$He(B
|e$BJ]>Z$9$k$3$H$,$G$-$k$N$G$7$g$&$+!)e(B

e$BB>$NE@$O$H$b$+$/$3$NE@$K$D$$$F$O$“$^$j?4G[$9$kI,MW$O$J$$$H;We(B
e$B$$$^$9!#$H$$$&$N$b!”%(%s%3!<%G%#%s%0$,A}$($k$3$H$OLGB?$K$"$je(B
e$B$^$;$s$7!"A}$($?$H$7$F$b$=$l$,%W%m%0%i%`$K$h$C$FCYBZ$J$/%5%]!<e(B
e$B%H$5$l$k$3$H$OC/$b4|BT$7$J$$$G$7$g$&$+$i!#e(B

e$B$?$@!“8=>u$N<BAu$O$=$l$G$be(BASCII-8BITe$B$,$D$$$?%F%-%9%H$,EP>l$9e(B
e$B$kM>CO$,$”$je(B[ruby-dev:33040]e$B!“$=$l$O$^$:$$$h$&$J5$$,$7$^$9$Ne(B
e$B$G!“e(BBINARYe$B$O$”$C$F$b$h$$$H$$$&N)>l$G$9!#$”$k$$$Oe(BASCII-8BITe$BKPe(B
e$BLG:n@o$rE83+$9$k$H$$$&N)>l$b$“$k$G$7$g$&$,!”%l%W%j%+$R$H$D:ne(B
e$B$k$@$1$Ne(BBINARYe$BF3F~$KHf$Y$k$HAjEv$KITLS$J5$$,$7$^$9!#e(B

e$B$^$?!“e(BDave
Thomase$B$,;XDj$7$?$h$&$Je(B[ruby-core:14993]e$B!”!VL50U<1e(B
e$B$N2>Dj$b$"$k$+$ie(Basciicompate$B$G$$$$$s$@$1$I!"e(Bcasee$B$rM}2r$9$k$N$Oe(B
e$B$*$+$7$$!W$H$$$&M}6~$bJ,$+$k$h$&$J5$$,$7$^$9!#e(B

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

In article [email protected],
Hidetoshi NAGAI [email protected] writes:

e$B$G$“$k$J$i!$e(Bb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9$k5,3J$G$"$k$3$HB?$/!“8D?M$,9%$-e(B
    e$B>!<j$KDj5A$9$k$3$H$O$”$^$j$J$$e(B

  2. Unicode e$B$NIa5Z$K$h$j!"e(BUnicode e$B0J30$NJ8;z%3!<%I$N5,3J$r:ne(B
    e$B$kF05!$O8:>/$7$F$$$ke(B

e$B$b$A$m$sJ]>Z$O$G$-$^$;$s!#$I$3$+$N9q$,!“$$$-$J$j5$$,68$C$?$he(B
e$B$&$K$?$/$5$s$NJ8;z%3!<%I5,3J$rDj5A$7;O$a$J$$$H$b8B$j$^$;$s!#e(B
e$B$^$?!”$=$&$$$&$3$H$r9T$&FHN)9q$r:n$k?M$,$$$J$$$H$O8B$j$^$;$s!#e(B
e$B$G$9$,!"$^$:$=$s$J$3$H$O$J$$$@$m$&$H$b;W$$$^$9!#e(B

e$B8=>u$G$Oe(B

$ echo $LANG
ja_JP.eucJP
$ ruby19 -v
ruby 1.9.0 (2008-01-10 revision 0) [i686-linux]
$ ruby19 -e ‘a = “aaa”; e = “e$B4A;ze(B”; p [a.encoding, e.encoding, Encoding.default_external]’
[#Encoding:ASCII-8BIT, #Encoding:ASCII-8BIT, #Encoding:EUC-JP]

e$B$H$$$&$3$H$K$J$j$^$9$,!$$3$l$O8=>u$,4V0c$C$F$$$k$H$$$&$3$H$G$7$g$&$+!)e(B

e$B:G=i$Ne(B a e$B$Oe(B ASCII e$B$7$+4^$^$l$F$$$J$$$N$Ge(B ASCII-8BIT
e$B$H$J$C$Fe(B
e$B$$$F$b!"JQ49$;$:$KAw$C$F$b$J$s$NLdBj$b$J$$$H;W$$$^$9!#e(B

e$B<!$Ne(B e e$B$Oe(B Ruby e$B%9%/%j%W%H$NJ8;z%3!<%I$Oe(B locale
e$B$K0MB8$;$:!"e(B
magic comment e$B$G5-=R$9$k$H$$$&5,B’$@$+$i$G$9!#$3$l$O%9%/%j%We(B
e$B%H<+BN$,e(B locale e$B$K4X78$J$/F0$/$3$H$,4|BT$5$l$F$$$k$N$,M}M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