Pattern match with UTF-8 regexp and EUC-JP string

/./u e$B$H$$$&e(B UTF-8 e$B$Je(B 1e$BJ8;z$rI=8=$9$k%Q%?!<%s$Ke(B EUC-JP
e$B$Je(B
“\xa1\xa1” e$B$H$$$&e(B 1e$BJ8;z$JJ8;zNs$r%^%C%A$5$;$?$H$-!“e(B”\241"
e$B$He(B
e$B$$$&e(B 1e$B%P%$%H$K%^%C%A$7$^$9!#e(B

% ./ruby -ve ‘p(/./u =~ “\xa1\xa1”.force_encoding(“euc-jp”)); puts
$&.dump’
ruby 1.9.0 (2007-10-20 patchlevel 0) [i686-linux]
0
“\241”

UTF-8 e$B$G$be(B EUC-JP e$B$G$b$J$$e(B “\241” e$B$H$$$&e(B
1e$B%P%$%H$,=P$F$/$k$Ne(B
e$B$O$*$+$7$$$H;W$$$^$9!#e(B

e$B%Q%?!<%s$,e(B UTF-8 e$B$G$"$k$3$H$rB:=E$7$Fe(B character encodings
differ e$B$K$J$k$+!"$"$k$$$Oe(B EUC-JP e$B$Je(B
1e$BJ8;z$K%^%C%A$9$k$+$I$Ae(B
e$B$i$+$,4|BT$5$l$kF0:[email protected]$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B

At 15:25 07/10/21, Tanaka A. wrote:

e$B$O$*$+$7$$$H;W$$$^$9!#e(B

e$B%Q%?!<%s$,e(B UTF-8 e$B$G$"$k$3$H$rB:=E$7$Fe(B character encodings
differ e$B$K$J$k$+!"$"$k$$$Oe(B EUC-JP e$B$Je(B 1e$BJ8;z$K%^%C%A$9$k$+$I$Ae(B
e$B$i$+$,4|BT$5$l$kF0:[email protected]$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B

e$BEDCf$5$s$HL^[email protected]$G$9!#LdBj$N860x$r?dB,$7$^$9$H!“e(B\xa1 / \241
e$B$Oe(B UTF-8 e$B$GJ8;z$rCx$9%P%$%[email protected],$K$O$”[email protected]$J$$$N$G!"e(B
e$B%(%i!<BP:v$H$7$F0lJ8;z$HF1Ey$K07$o$l$F$$$k$N$G$O$J$$$G$7$g$&$+!#e(B

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

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

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