Encoding.compatible? and dummy encodings

e$B$3$s$K$A$Oe(B sheepman e$B$G$9!#e(B

ISO-2022-JP e$B$JJ8;zNs$He(B EUC-JP e$B$JJ8;zNs$,e(B compatible e$B$He(B
e$B$J$j$^$9$,$3$l$O0U?^$5$l$?$3$H$G$7$g$&$+!#e(B

dummy e$B%(%s%3!<%G%#%s%[email protected]$H$3$&$$$&Iw$K$J$k$b$N$J$N$G$7$g$&$+!#e(B

$ cat t.rb
#-- coding: euc-jp --
s = “e$B4A;ze(B”
i = “e$B4A;ze(B”.encode(“ISO-2022-JP”)
p Encoding.compatible?(s, i)
p s + i

$ ruby-1.9 -v t.rb
ruby 1.9.0 (2008-01-13 revision 0) [i686-linux]
#Encoding:EUC-JP
“e$B4A;ze(B\e$B4A;z\e(B”

[email protected]@%$G$9!#e(B

sheepman wrote:

p s + i

$ ruby-1.9 -v t.rb
ruby 1.9.0 (2008-01-13 revision 0) [i686-linux]
#Encoding:EUC-JP
“e$B4A;ze(B\e$B4A;z\e(B”

dummy encoding [email protected]$+$i$G$O$J$/!“e(B”\e$B4A;z\e(B" e$B$,e(B 7bit ASCII
e$B$NHO0O$K<}e(B
e$B$^$C$F$$$k$+$i$G$9$Me(B (rb_enc_str_asciionly_p)e$B!#e(BISO-2022-JP
e$B$O>o$Ke(B 7bit
e$B$J$N$Ge(B EUC-JP [email protected]$1$G$J$/!"e(BShift_JIS e$B$H$be(B UTF-8
e$B$H$be(B compatible e$B$K$J$j$^$9!#e(B

e$B$3$l$I$&$7$^$7$g$&$+!#e(BESC/SI/SO
e$B$,$"$C$?$i%@%a$H$+$G$7$g$&$+$M$’!&!&!&!#e(B

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

In message “Re: [ruby-dev:33077] Re: Encoding.compatible? and dummy
encodings”
on Sun, 13 Jan 2008 22:08:18 +0900, “NARUSE, Yui”
[email protected] writes:

|dummy encoding [email protected]$+$i$G$O$J$/!“e(B”\e$B4A;z\e(B" e$B$,e(B 7bit ASCII e$B$NHO0O$K<}e(B
|e$B$^$C$F$$$k$+$i$G$9$Me(B (rb_enc_str_asciionly_p)e$B!#e(BISO-2022-JP e$B$O>o$Ke(B 7bit
|e$B$J$N$Ge(B EUC-JP [email protected]$1$G$J$/!“e(BShift_JIS e$B$H$be(B UTF-8 e$B$H$be(B compatible e$B$K$J$j$^$9!#e(B
|
|e$B$3$l$I$&$7$^$7$g$&$+!#e(BESC/SI/SO e$B$,$”$C$?$i%@%a$H$+$G$7$g$&$+$M$’!&!&!&!#e(B

dummye$B$Oe(Bcompatiblee$B$8$c$J$$$H$+!#e(B7bite$B$NHO0O$Ke(BESCe$B$r4^$a$J$$$H$+!#e(B
e$B$I$C$A$,$$$$$+$J!#e(B

[email protected]$G$9!#e(B

At Mon, 14 Jan 2008 15:46:23 +0900,
Yukihiro M. wrote in [ruby-dev:33084]:

|dummy encoding [email protected]$+$i$G$O$J$/!“e(B”\e$B4A;z\e(B" e$B$,e(B 7bit ASCII e$B$NHO0O$K<}e(B
|e$B$^$C$F$$$k$+$i$G$9$Me(B (rb_enc_str_asciionly_p)e$B!#e(BISO-2022-JP e$B$O>o$Ke(B 7bit
|e$B$J$N$Ge(B EUC-JP [email protected]$1$G$J$/!“e(BShift_JIS e$B$H$be(B UTF-8 e$B$H$be(B compatible e$B$K$J$j$^$9!#e(B
|
|e$B$3$l$I$&$7$^$7$g$&$+!#e(BESC/SI/SO e$B$,$”$C$?$i%@%a$H$+$G$7$g$&$+$M$’!&!&!&!#e(B

dummye$B$Oe(Bcompatiblee$B$8$c$J$$$H$+!#e(B7bite$B$NHO0O$Ke(BESCe$B$r4^$a$J$$$H$+!#e(B
e$B$I$C$A$,$$$$$+$J!#e(B

e$B8e<T$Oe([email protected]$($,5/$3$k$b$N$G$J$$$H8z2L$,$J$$$N$G!"e(BEBCDICe$B$J$Ie(B
e$B$r9M$($k$H0UL#$,$J$$$H;W$$$^$9!#e(B

iso-2022-jpe$B$He(BASCIIe$B$,$/$C$D$1$i$l$J$$$H$$$&$N$bHa$7$$$N$G!“e(Bdummy
e$B$OF1$8$b$N$+e(Bbase
encodinge$B$H$Oe(Bcompatiblee$B$H$7$?$$$H$3$m$G$9$,!”$de(B
e$B$O$je(BEBCDICe$B$J$I$N$h$&$Ke(BASCII
compatiblee$B$G$J$$$b$N$r9M$($k$H!"$^$:e(B
e$B$$$3$H$K$J$j$=$&$G$9!#$=$&$$$&$b$N$O!"e(BASCII-8BITe$B$H$OJL$b$N$r%Y!<e(B
e$B%9$K$9$k$H$+$7$J$$$H$$$1$J$$$+$b!#e(B

e$B$3$s$P$s$O!"e(Bsheepman e$B$G$9!#e(B

On Sun, 13 Jan 2008 22:08:18 +0900
“NARUSE, Yui” [email protected] wrote:

dummy encoding [email protected]$+$i$G$O$J$/!“e(B”\e$B4A;z\e(B" e$B$,e(B 7bit ASCII e$B$NHO0O$K<}e(B
e$B$^$C$F$$$k$+$i$G$9$Me(B (rb_enc_str_asciionly_p)e$B!#e(BISO-2022-JP e$B$O>o$Ke(B 7bit
e$B$J$N$Ge(B EUC-JP [email protected]$1$G$J$/!"e(BShift_JIS e$B$H$be(B UTF-8 e$B$H$be(B compatible e$B$K$J$j$^$9!#e(B

e$B$J$k$[$I!“N;2r$7$^$7$?!#e(B e$B$”$j$,$H$&$4$6$$$^$9!#e(B

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

In message “Re: [ruby-dev:33089] Re: Encoding.compatible? and dummy
encodings”
on Mon, 14 Jan 2008 17:47:51 +0900, Nobuyoshi N.
[email protected] writes:

|e$B8e<T$Oe([email protected]$($,5/$3$k$b$N$G$J$$$H8z2L$,$J$$$N$G!"e(BEBCDICe$B$J$Ie(B
|e$B$r9M$($k$H0UL#$,$J$$$H;W$$$^$9!#e(B

EBCDICe$B$OEvLL9M$($J$/$F$b$h$$$H;W$$$^$9!#$I$&$+$s$,$([email protected],e(B
e$BI=8=$H$+;H$($J$$$7!#e(B

[email protected]@%$G$9!#e(B

Yukihiro M. wrote:

dummye$B$O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>l9g!"=hM}$r6K8BIT2DG=$K$9$k$N$Oe(B
[email protected]$H;W$$$^$9!#6K8B$K!"F~NO$H=PNO0J30$K$O;H$($J$/$F!“B>$K2?$+e(B
e$B=hM}$7$?$$>l9g$K$Oe(B (e$B<+?.$,$”$k?M$Oe(B) binary e$B$de(B ASCII
e$B$J$I$G=hM}$9$k$+!"e(B
e$BJQ49$9$k$+$K$9$kJ}$,%Y%9%H$H;W$$$^$9!#e(B

e$B59$7$/$*4j$$$7$^$9!#e(B

#-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-# http://www.sw.it.aoyama.ac.jp mailto:[email protected]

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

In message “Re: [ruby-dev:33094] Re: Encoding.compatible? and dummy
encodings”
on Mon, 14 Jan 2008 22:04:15 +0900, Martin D.
[email protected] writes:

|e$B$=$b$=$be(B ISO-2022-JP e$B$be(B UTF-7 e$B$bFbIt=hM}$N$?$a$K:n$i$l$F$J$$$7!“e(B
|e$BFbIt=hM}$K8~$$$F$J$$!#Nc$($Pe(B ISO-2002-JP e$B$N>l9g$K!“J8;zNs$r4JC1$Ke(B
|e$B7k9g$9$k$K$O7h$^$j$,I,MW$G$9$,!”$=$&$$$&7h$^$j$O$”$j$^$;$se(B
|(e$B:n$j$?$$$H;W$($P:n$l$k$H;W$$$^$9$,e(B)e$B!#$G$b$=$N7h$^$j$r<i$k$?$a$Ke(B
|e$BJ8;zNs$N0lIt<h$j=P$7$N$H$3$m$GBgJQ6lO+$7$J$$$H9T$1$J$$$G$9!#e(B
|UTF-7 e$B$bF1$8$G$9!#e(B
|
|[email protected]$7$$J}[email protected]$H$7$F!"$=$&$$$&e(B Encoding e$B$N>l9g!"=hM}$r6K8BIT2DG=$K$9$k$N$Oe(B
|[email protected]$H;W$$$^$9!#6K8B$K!"F~NO$H=PNO0J30$K$O;H$($J$/$F!“B>$K2?$+e(B
|e$B=hM}$7$?$$>l9g$K$Oe(B (e$B<+?.$,$”$k?M$Oe(B) binary e$B$de(B ASCII e$B$J$I$G=hM}$9$k$+!"e(B
|e$BJQ49$9$k$+$K$9$kJ}$,%Y%9%H$H;W$$$^$9!#e(B

e$B$&!<$s!"$*$C$7$c$kDL$j$G$9!#$H$9$k$H!Ve(Bdummye$B$Oe(Bcompatiblee$B$G$Je(B
e$B$$!W$NJ}$,@52r$J$N$G$7$g$&$M!#$3$N>l9g!"<+J,<+?H$H$Oe(B
compatiblee$B$J$N$G$7$g$&$+!#e(B

[email protected]@%$G$9!#e(B

In message “Re: [ruby-dev:33094] Re: Encoding.compatible? and dummy
encodings”
on Mon, 14 Jan 2008 22:04:15 +0900, Martin D.
[email protected] writes:
|e$B=hM}$7$?$$>l9g$K$Oe(B (e$B<+?.$,$"$k?M$Oe(B) binary e$B$de(B ASCII e$B$J$I$G=hM}$9$k$+!"e(B
|e$BJQ49$9$k$+$K$9$kJ}$,%Y%9%H$H;W$$$^$9!#e(B

e$B$"!<!"$J$k$[$I!"3N$+$K!#e(B

Yukihiro M. wrote:

e$B$&!<$s!"$*$C$7$c$kDL$j$G$9!#$H$9$k$H!Ve(Bdummye$B$Oe(Bcompatiblee$B$G$Je(B
e$B$$!W$NJ}$,@52r$J$N$G$7$g$&$M!#$3$N>l9g!"<+J,<+?H$H$Oe(B
compatiblee$B$J$N$G$7$g$&$+!#e(B

e$B<+J,<+?H$H$Oe(B compatible
e$B$K$7$J$$$H!"%U%!%$%k$+$i%P%C%U%!$KC<!FI$_9~$!"e(B
e$B$J$s$F$H$-$K$:$C$3$1$^$9$M!#e(B

buf = ‘’
open(‘hoge.txt’, ‘r:iso-2022-jp’) do |f|
until f.eof?
buf += f.redpartial(4096)
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs