Rails3 M17N

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

Yehuda
Katze$B$+$ie(BRails2e$B$re(B1.9e$B$GF0$+$7$?>l9g!"%(%s%3!<%G%#%s%04Xe(B
e$B78$NNc30$,BgNL$KH/@8$9$k$N$G!“0lHL%f!<%6$Ne(BRail3e$B$X$N0\9T$K>ce(B
[email protected]$,$”$k$HO"Mm$r$b$i$$$^$7$?!#e(B

e$BH`[email protected]$1$Ge(B1.9e$B$rMQ$$$?E,@Z$Je(BM17Ne$B2=$r<+J,$G9M$($k$N$OBgJQ:$Fq$Je(B
[email protected]$H;W$$$^$9$+$i!"=u$1$F$"$2$?$$$H$3$m$G$9!#$$$<$s$H$7$Fe(B
Railse$B$Oe(BRubye$B$K$H$C$F=EMW$J%"%W%j%1!<%7%g%s$J$N$G!"e(BRails3e$B$KBP$7e(B
[email protected]$K$7$F$*$/[email protected]$m$&$H9M$($^$9!#e(B

e$B$H$O$$$(!";d<+?H$,e(BRailse$B$de(BWebe$B%"%W%j$K$D$$$FL5CN$J$N$OG’$a$6$ke(B
e$B$r$($^$;$s!#$^$?!"<+J,$,4pK%G%6%$%s$7$?$H$O$$$(!“e(BM17Ne$B$K$D$$e(B
e$B$F$b!”@[email protected]%[email protected]$&$N$,p$G$9!#e(B

e$B$H$$$&$o$1$G!"$`$7$m;d$NJ}$,[email protected]$-$?$$!#e(B

e$B$6$C$H9M$($F$_$?$H$3$m!"J8;zNs$N%=!<%9$Oe(B

(1) Railse$BK\BNe(B
(2) e$B%W%i%0%$%se(B
(3) e$B%F%s%W%l!<%He(B
(4) e$B%b%G%k$J$I%f!<%6!<$,=q$$$?e(BRubye$B%3!<%Ie(B
(5) e$B%G!<%?%Y!<%9e(B
(6) e$B%/%i%$%"%s%He(B(e$B%V%i%&%6e(B)e$B$+$i$NF~NOe(B

e$B$KJ,N`$G$-$k$N$G$O$J$$$+$H;W$$$^$9!#O3$l$O$"$j$^$;$s$+!)e(B

(1) Railse$BK\BN$K$D$$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$g$&$+!#$D$$$F$$$k$N$G$"$l$P!"FbIt%(%s%3!<%G%#%s%0e(B
e$B$Xe(Bencode()e$B$7$F$d$l$P$h$$$o$1$G$9$,!#e(B

e$B$3$N$3$H$+$i9M$($k$H!"e([email protected]_Dj%U%!%$%k$K!"e(B

  • e$B%"%W%jFbIt%(%s%3!<%G%#%s%0e(B
  • e$B%G!<%?%Y!<%9e(B(e$B$4$H$Ne(B)e$B%(%s%3!<%G%#%s%0e(B

e$B$r!"e(B(e$B$?$V$s%G%U%)%k%H$Oe(BUTF-8e$B$Ge(B)[email protected]_Dj$G$-$k$h$&$K$7$F$d$l$P!"e(B
e$B30It%$%s%?%U%’!<%9$H$7$F$O==J,$N$h$&$J5$$,$7$^$9!#$G!"e(BRails
e$BFbIt$GI,MW$K1~$8$Fe(Bencode()e$B$7$^$/$k$s$G$7$g$&$M!#e(B

e$B$5$F!“BgNL$K8+Mn$H$7$,$”$k5$$,$7$FIT0B$J$N$G$9$,!"$_$J$5$s$Ne(B
e$B$40U8+$rD0$+$;$F$/[email protected]$5$$!#>e5-$N%"%$%G%#%"$,[email protected]$G$J$$$H;W$(e(B
e$B$?$i!"e(BRailse$B%A!<%`$KDs0F$7$^$9!#e(B

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

xibbare$B$3$HF#2,$G$9!#e(B

  • e$B%G!<%?%Y!<%9e(B(e$B$4$H$Ne(B)e$B%(%s%3!<%G%#%s%0e(B

e$B$r!"e(B(e$B$?$V$s%G%U%)%k%H$Oe(BUTF-8e$B$Ge(B)[email protected]_Dj$G$-$k$h$&$K$7$F$d$l$P!"e(B
e$B30It%$%s%?%U%’!<%9$H$7$F$O==J,$N$h$&$J5$$,$7$^$9!#$G!"e(BRails
e$BFbIt$GI,MW$K1~$8$Fe(Bencode()e$B$7$^$/$k$s$G$7$g$&$M!#e(B

e$B$5$F!“BgNL$K8+Mn$H$7$,$”$k5$$,$7$FIT0B$J$N$G$9$,!"$_$J$5$s$Ne(B
e$B$40U8+$rD0$+$;$F$/[email protected]$5$$!#>e5-$N%"%$%G%#%"$,[email protected]$G$J$$$H;W$(e(B
e$B$?$i!"e(BRailse$B%A!<%`$KDs0F$7$^$9!#e(B

e$B$3$Ne(B6e$B$K$D$$$F$Oe(Bcgi.rbe$B$G$bBgJ,G:$_$^$7$?!#e(B
[email protected]$H$7$F$O%G%U%)%k%H$NF~NO%(%s%3!<%G%#%s%0$re(B
e$BDj5A$9$k$3$H$J$s$G$9$,!“9MN8$,$$$m$$$m$HB-$j$F$$$J$$$H;W$$$^$9!#e(B
e$B$=$7$F!”$^$D$b$H$5$s$,F1$8$3$H$r9M$($F$$$?$h$&$G$9$,!“e(B
e$B;d$H$7$F$O$$$$$N$+$I$&$+HyL/$G$9!#e(B
e$BK\Ev$K$7$C$+$j$d$k$N$G$”$l$P!"e(B

  1. e$B<u$1$?$H$-$Ne(Bencodinge$B$Oe(BASCII-8BITe$B$K$9$ke(B
  2. e$BJQ49$7$?$$e(Bencodinge$B$,$"$k9`L$O%"%W%jB&$GGD0.$7!"e(B
    UTF-8e$B$X$Ne(Bforce_encodinge$B$r;n$_$ke(B

e$BJQ498e!“e(Bencodinge$B$N%A%’%C%/$r$7$F!”$$+$7$$$N$ONc30$rEj$2$ke(B
e$B$,M}A[E
[email protected]$H;W$$$^$9!#e(B
e$B0l=o$Ke(Baccept-encodinge$B$_$?$$$JNs5s9`L$re(Bposte$B$7$F$b$i$&$H$+!#e(B

e$B$A$J$_$K!"e(Bencode()e$B$Oe(BASCII-8BITe$B$G$ONc30$J$N$G!"e(B

cgi.rbe$B$G$OA4$/;H$C$F$$$J$$!#e(B

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

In message “Re: [ruby-dev:41105] Re: Rails3 M17N”
on Fri, 30 Apr 2010 12:00:44 +0900, Fujioka [email protected] writes:

|e$BK\Ev$K$7$C$+$j$d$k$N$G$"$l$P!"e(B
|1. e$B<u$1$?$H$-$Ne(Bencodinge$B$Oe(BASCII-8BITe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XDj$9$ke(B
e$B$3$H$GNc30$r2sHr$G$-$^$9!#e(B

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

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

|# e$B$A$J$_$K!"e(Bencode()e$B$Oe(BASCII-8BITe$B$G$ONc30$J$N$G!"e(B
|# cgi.rbe$B$G$OA4$/;H$C$F$$$J$$!#e(B

e$B85$N%(%s%3!<%G%#%s%0$,$o$+$l$P!"e(Bencode()e$B$NBhe(B2e$B0z?t$r;XDj$9$ke(B
e$B$3$H$GNc30$r2sHr$G$-$^$9!#e(B

e$B$3$l$OCN$i$J$+$C$?!#e(Borz

irb(main):006:0>
“e$B$U$8$*$+e(B”.force_encoding(“ASCII-8BIT”).encode(“UTF-
8”,“ASCII-8BIT”)
Encoding::UndefinedConversionError: “\xE3” from ASCII-8BIT to UTF-8
from (irb):6:in encode' from (irb):6 from /Users/fujioka/local/bin/irb19:12:in

e$B$G$9!#$J$s$+4V0c$C$F$$$k$N$+$J!#%*%W%7%g%s;XDj$7$F$be(B

irb(main):009:0*
“e$B$U$8$*$+e(B”.force_encoding(“ASCII-8BIT”).encode(“UTF-
8”,“ASCII-8BIT”,:invalid=>:replace)
Encoding::UndefinedConversionError: “\xE3” from ASCII-8BIT to UTF-8
from (irb):9:in encode' from (irb):9 from /Users/fujioka/local/bin/irb19:12:in

e$B$&!<$s!#!#!#e(B

xibbare$B$3$HF#2,$G$9!#e(B

|e$BK\Ev$K$7$C$+$j$d$k$N$G$"$l$P!"e(B
|1. e$B<u$1$?$H$-$Ne(Bencodinge$B$Oe(BASCII-8BITe$B$K$9$ke(B

e$B$"!"$=$&$=$&!#e(BRacke$B$de(BDBe$B%I%i%$%P$Oe(BASCII-8BITe$B$rJV$9$Y$-$G$O$J$$e(B
e$B$+$H$+$s$,$($F$$$^$9!#e(B

e$B2hA|%U%!%$%k$r%"%C%W%m!<%I$7$?;~$Ne(Bencodinge$B$O$I$&$7$^$9$+!)e(B
POSTe$B$be(BGETe$B$b%P%$%J%j%G!<%?$G$"$C$FJ8;zNs$8$c$J$$$H;d$O;W$&$N$G$9$,!#e(B
e$B%U%!%$%[email protected]$1Nc30E*$K07$C$?J}$,$$$$$H$$$&$*9M$($G$9$+!)e(B

e$B$$$d!"?dB,=PMh$^$;$s!#?dB,=PMh$J$$$N$G!“e(B
e$B<u$1<j$G$3$Ne(Bencodinge$B$GMh$k$O$:[email protected]$H9=$($k$7$+$”$j$^$;$s!#e(B

|3. e$BJQ498e!“e(Bencodinge$B$N%A%’%C%/$r$7$F!”$$+$7$$$N$ONc30$rEj$2$ke(B
|e$B$,M}A[E
[email protected]$H;W$$$^$9!#e(B
|e$B0l=o$Ke(Baccept-encodinge$B$_$?$$$JNs5s9`L$re(Bposte$B$7$F$b$i$&$H$+!#e(B

e$B$3$N%"%W%m!<%A$O%"%W%jB&$G$NBP1~$,I,MW$J$N$GK>$^$7$/$"$j$^$;e(B
e$B$s$M!#3N<B$G$7$g$&$1$I!#e(B

e$B$3$l$O%U%l!<%`%o!<%/$,5[<}$G$$$$$H;W$$$^$9!#e(B

|# e$B$A$J$_$K!"e(Bencode()e$B$Oe(BASCII-8BITe$B$G$ONc30$J$N$G!"e(B
|# cgi.rbe$B$G$OA4$/;H$C$F$$$J$$!#e(B

e$B85$N%(%s%3!<%G%#%s%0$,$o$+$l$P!"e(Bencode()e$B$NBhe(B2e$B0z?t$r;XDj$9$ke(B
e$B$3$H$GNc30$r2sHr$G$-$^$9!#e(B

e$B$3$l$OCN$i$J$+$C$?!#e(Borz

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

2010e$BG/e(B4e$B7ne(B30e$BF|e(B11:32 Yukihiro M.
[email protected]:

|2. e$BJQ49$7$?$$e(Bencodinge$B$,$"$k9`L$O%"%W%jB&$GGD0.$7!"e(B
| UTF-8e$B$X$Ne(Bforce_encodinge$B$r;n$_$ke(B

UTF-8e$B$J$s$G$9$+!#;d$O%"%W%j%(%s%3!<%G%#%s%[email protected]$H;W$Ce(B
e$B$F$$$?$N$G$9$,!#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%j%Q%i%a!<%?$H$7$FM?$($l$kJ8;zNs$Ne(B
e$B%(%s%3!<%G%#%s%0$G!"$3$l$O%j%s%/Ey$N>l9g!"%j%s%/85$Ne(B
HTMLe$B$N%(%s%3!<%G%#%s%0$K0MB8$9$k$?$a!“F10l%Z!<%8$X$Ne(B
e$B%”%/%;%9$G$b!J%j%s%/85$,0[$J$l$P!Ke([email protected]$C$?$je(B
[email protected]$C$?$j$9$k$3$H$,$7$P$7$P$"$j$^$9!#$^$“e(B
e$B%”%W%jFb$G$O;HMQ$9$ke(BHTMLe$B$N%(%s%3!<%G%#%s%0$OGD0.!&e(B
[email protected])8f$G$-$k$O$:$J$N$G!"$=$l0J30!J30It%5%$%H$+$i$Ne(B
e$B%j%s%/$N>l9g$H$+!K$O?dB,e(B and/or e$B4V0c$C$?$i$4$a$s!"$+$J$"$H!#e(B

|3. e$BJQ498e!“e(Bencodinge$B$N%A%’%C%/$r$7$F!”$$+$7$$$N$ONc30$rEj$2$ke(B
|e$B$,M}A[E
[email protected]$H;W$$$^$9!#e(B
|e$B0l=o$Ke(Baccept-encodinge$B$_$?$$$JNs5s9`L$re(Bposte$B$7$F$b$i$&$H$+!#e(B

e$B$3$N%"%W%m!<%A$O%"%W%jB&$G$NBP1~$,I,MW$J$N$GK>$^$7$/$"$j$^$;e(B
e$B$s$M!#3N<B$G$7$g$&$1$I!#e(B

e$BNc30$O$$$m$$$m87$7$$$+$b!D!#e(Bvalidatione$B$N%%V%8%’%/%H$Ke(B
e$B%(%i!<$N>pJs$,F~$C$F$F$[[email protected])8f%U%m!<$ODL>o$N$^$^!K$,e(B
e$BM}A[E
$+$b$G$9!#$C$F!"$=$NJU$j$O%U%l!<%`%o!<%/$H$N7s$M9g$$e(B
e$B$G$9$,!#e(B

[email protected],5Ae(B ([email protected])

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

From: Fujioka <fuj_at_rabbix.jp>
Date: Fri, 30 Apr 2010 13:05:44 +0900

from /Users/fujioka/local/bin/irb19:12:in `’

e$B$G$9!#$J$s$+4V0c$C$F$$$k$N$+$J!#%*%W%7%g%s;XDj$7$F$be(B

e$B!V85$N%(%s%3!<%G%#%s%[email protected]$&$N$O!"e(BASCII-8BIT
e$B$K$J$kA0$N%(%s%3!<%G%#e(B
e$B%s%0$C$F$3$H$8$c$J$$$G$7$g$&$+!)e(B

-- coding: utf-8 --

s = “e$B$$$^$$e(B”.force_encoding(“ASCII-8BIT”).encode(“UTF-8”, “UTF-8”)

=> “e$B$$$^$$e(B”

s.encoding

=> #Encoding:UTF-8

s =
“e$B$$$^$$e(B”.encode(“Shift_JIS”).force_encoding(“ASCII-8BIT”).encode(“UTF-8”,
“Shift_JIS”)

=> “e$B$$$^$$e(B”

s.encoding

=> #Encoding:UTF-8

Yukihiro M. さんは書きました:

Yehuda K.からRails2ã‚’1.9ã§å‹•ã‹ã—ãŸå ´åˆã€ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°é–¢
係の例外が大量に発生するので、一般ユーザのRail3への移行に障
害になる可能性があると連絡をもらいました。

ちょっと前から不思議に思っているのですが、具体的にどういう例外が出ているんで
しょうか? いやこの話を聞く度に実例が出てこないもので。

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

In message “Re: [ruby-dev:41111] Re: Rails3 M17N”
on Fri, 30 Apr 2010 14:10:46 +0900, Urabe S.
[email protected] writes:

|e$B$A$g$C$HA0$+$iIT;W5D$K;W$C$F$$$k$N$G$9$,!"6qBNE*$K$I$&$$$&Nc30$,=P$F$$$k$s$Ge(B
|e$B$7$g$&$+e(B? e$B$$$d$3$NOC$rJ9$/EY$K<BNc$,=P$F$3$J$$$b$N$G!#e(B

e$B0l$D$NNc$H$7$F$O!"%F%s%W%l!<%H$N%(%s%3!<%G%#%s%0$HKd$a9~$`J8e(B
e$B;zNse(B(e$B$?$H$($P%G!<%?%Y!<%9$+$i$N$b$Ne(B)e$B$N%(%s%3!<%G%#%s%0$,%:%le(B
e$B$F$F!"e(B

incompatible character encodings: ASCII-8BIT and UTF-8
(Encoding::CompatibilityError)

e$B$,=P$k!"$H;d$OJ9$-$^$7$?!#e(B

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

In message “Re: [ruby-dev:41107] Re: Rails3 M17N”
on Fri, 30 Apr 2010 12:41:35 +0900, Fujioka [email protected] writes:

|> e$B$"!"$=$&$=$&!#e(BRacke$B$de(BDBe$B%I%i%$%P$Oe(BASCII-8BITe$B$rJV$9$Y$-$G$O$J$$e(B
|> e$B$+$H$+$s$,$($F$$$^$9!#e(B
|
|e$B2hA|%U%!%$%k$r%"%C%W%m!<%I$7$?;~$Ne(Bencodinge$B$O$I$&$7$^$9$+!)e(B
|POSTe$B$be(BGETe$B$b%P%$%J%j%G!<%?$G$"$C$FJ8;zNs$8$c$J$$$H;d$O;W$&$N$G$9$,!#e(B
|e$B%U%!%$%[email protected]$1Nc30E*$K07$C$?J}$,$$$$$H$$$&$*9M$($G$9$+!)e(B

e$B;d$N=q$$$?$N$O!VJV$9$Y$-$G$O$J$$$+!W!"$D$^$j!"[email protected]$He(B
e$B;W$&!W$G$9$h!#e(B1e$BJ8;[email protected]$1$G0UL#$,@5H[email protected](B
e$B8l$G$9$M!"F|K\8l$O!#e(B

e$B$H$O$$$(!"%P%$%J%j$N%U%#!<%k%I$H%F%-%9%H$N%U%#!<%k%I$,:.:_$7e(B
e$B$F$$$F!"%U%l!<%`%o!<%/%l%Y%[email protected]$&$N$OBgLdBje(B
e$B$G$"$k$3$H$K$OJQ$o$j$J$$$G$9$M!#@5D>!"[email protected]$O9M$($F$$$^$;$se(B
e$B$G$7$?!#e(B

  • e$B%U%#!<%k%I$,%P%$%J%j$+$I$&$+;XDj$9$k<jCJ$rDs6!$9$ke(B
  • TYPE=“file"e$B$N$b$N$O$H$j$”$($:e(BASCII-8BIT
    (e$B$=$s$J$N6hJL$G$-$?$C$1e(B)
  • e$B$=$l0J30$O%G%U%)%k%H$G%"%W%j%(%s%3!<%G%#%s%0$Ke(Bforce_encoding

e$B$G$9$+$M!#e(Bforce_encodinge$B$O>pJs$N7gB;$O$"$j$^$;$s$+$i!#$J$s$+e(B
e$BCOMk86$r:n$C$F$k$h$&$J5$$b$7$F62$$$G$9$,!#e(B

|> e$B0lHLE*$K$I$N$h$&$K%j%/%(%9%H$N%(%s%3!<%G%#%s%0$r?dB,$7$F$$$ke(B
|> e$B$N$G$7$g$&!#%R%e!<%j%9%F%#%C%/!)e(B
|>
|e$B$$$d!"?dB,=PMh$^$;$s!#?dB,=PMh$J$$$N$G!“e(B
|e$B<u$1<j$G$3$Ne(Bencodinge$B$GMh$k$O$:[email protected]$H9=$($k$7$+$”$j$^$;$s!#e(B

e$B$H$O$$$(!"@$$Ne(BWebe$B%"%W%j$GJ8;z2=$1$r8+$k$3$H$O>/$J$/$J$j$^$7e(B
e$B$?$h$M!#$=$l$O!"e(B

  • [email protected]$$NCf!"4pK\e(B UTF-8 e$B$G:Q$`$h$&$K$J$C$F$-$?e(B
  • e$B$J$s$+NI$$J}K!$,H/8+$5$l$?e(B

e$B$N$$$:$l$J$s$G$7$g$&$+!#e(B

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

e$B>[email protected][email protected]$$$^$9!#e(B

|e$B$A$g$C$HA0$+$iIT;W5D$K;W$C$F$$$k$N$G$9$,!"6qBNE*$K$I$&$$$&Nc30$,=P$F$$$k$s$Ge(B
|e$B$7$g$&$+e(B? e$B$$$d$3$NOC$rJ9$/EY$K<BNc$,=P$F$3$J$$$b$N$G!#e(B

e$B0l$D$NNc$H$7$F$O!"%F%s%W%l!<%H$N%(%s%3!<%G%#%s%0$HKd$a9~$`J8e(B
e$B;zNse(B(e$B$?$H$($P%G!<%?%Y!<%9$+$i$N$b$Ne(B)e$B$N%(%s%3!<%G%#%s%0$,%:%le(B
e$B$F$F!"e(B

incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)

e$B$,=P$k!"$H;d$OJ9$-$^$7$?!#e(B

e$BNc$($Pe(B MySQL e$B%I%i%$%P$G$"$ke(B MySQL/Ruby e$B$G$OA4$Fe(B
ASCII-8BIT e$B$K$J$k$N$G!"e(B
controller/view/helper/model
e$B$NCf$Ge(BUTF-8e$BJ8;zNs$H7k9g$7$?$j$9$k$He(B
e$B>e5-$N%(%i!<$,H/@8$7$^$9!#e(B

e$B$J$N$G!"%G!<%?%Y!<%9<~$j$G$NLdBj$O!"e(B
DBe$B%I%i%$%P$GE,@Z$Je(Bencodinge$B$r$D$1$FJV$9e(B or force_encoding
e$B$9$l$OBg>fIW$=$&$G$9!#e(B


e$B>.@n!!?-0lO:e(B (Shin-ichiro OGAWA)
[email protected]
GPG ID 94B70E36 / 75360751
fingerprint: {C64E 9826 8A75 723E DE54 / 70A8 F623 220C 94B7 0E36}
http://stnard.jp/
http://twitter.com/conceal_rs/
http://iddy.jp/profile/rust/

2010/4/30 Yukihiro M. [email protected]:

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

e$B$"!#$D$^$j!"F10U8+$G$7$?$+!#F|K\8l62$k$Y$7!#e(B

e$B$G$9$+$M!#e(Bforce_encodinge$B$O>pJs$N7gB;$O$"$j$^$;$s$+$i!#$J$s$+e(B
e$BCOMk86$r:n$C$F$k$h$&$J5$$b$7$F62$$$G$9$,!#e(B

cgi.rbe$B$N;~$KF1$8LdBj$K$V$AEv$?$C$F!"e(B
cgi.rbe$B$Oe(BUTF-8e$B$r%G%U%)%k%H$K$7$F!"JQ99=PMh$k$h$&$K$7$^$7$?!#e(B
filee$B$N;[email protected]$1e(BASCII-8BITe$B$K$7$F$$$^$9!#e(B

  • e$B$J$s$+NI$$J}K!$,H/8+$5$l$?e(B

[email protected]$$NCf$[$H$s$Ie(BUTF-8e$B$K$J$C$F$-$?$N$H!“e(B
e$B%V%i%&%6$,e(BIEe$B0J30$,Ia5Z$7$F$-$?$+$i$G$O$J$$$G$7$g$&$+!#e(B
IEe$B0J30$,Ia5Z$7$F!”$I$N%V%i%&%6$G$b8+$i$l$k$h$&$Ke(B
[email protected]$7$F$-$?$N$G$O!)e(B

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

In message “Re: [ruby-dev:41115] Re: Rails3 M17N”
on Fri, 30 Apr 2010 16:42:50 +0900, Shin-ichiro OGAWA
[email protected] writes:

|e$BNc$($Pe(B MySQL e$B%I%i%$%P$G$"$ke(B MySQL/Ruby e$B$G$OA4$Fe(B ASCII-8BIT e$B$K$J$k$N$G!"e(B
|controller/view/helper/model e$B$NCf$Ge(BUTF-8e$BJ8;zNs$H7k9g$7$?$j$9$k$He(B
|e$B>e5-$N%(%i!<$,H/@8$7$^$9!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B

|e$B$J$N$G!"%G!<%?%Y!<%9<~$j$G$NLdBj$O!"e(B
|DBe$B%I%i%$%P$GE,@Z$Je(Bencodinge$B$r$D$1$FJV$9e(B or force_encoding e$B$9$l$OBg>fIW$=$&$G$9!#e(B

e$B%I%i%$%P$G$d$k$Y$-$+!"%U%l!<%%o!<%/$G$d$k$Y$-$+G:$^$7$$$H$3e(B e$B$m$G$9$M!#8D?ME*$K$O!"%"%@%W%?$+%U%l!<%%o!<%/$+$$$:$l$+$GBPe(B
e$B1~$7$F!"%I%i%$%P$Oe(BASCII-8BITe$B$rJV$9$Y$-$G$O$J$$$+$H;W$$$D$D$"e(B
e$B$j$^$9!#e(B

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

(2010/04/30 13:23), masayoshi takahashi wrote:

e$B$=$N%U%)!<%$Ne(BHTMLe$B<+BN$b%U%l!<%%o!<%/B&[email protected]@.$7$Fe(B
e$B$$$k$O$:$J$N$G!"$=$NJ8;z%3!<%I$O$o$+$C$F$k$O$:!#$J$N$G!"e(B
e$B$=$l$K9g$o$;$F$*$1$P=hM}$G$-$k46$8$G$9!#e(B

form e$BMWAG$Ne(B accept-charset
[email protected]$+!"$=$NJ8=q$N%(%s%3!<%G%#%s%0$+!"e(B
e$B%V%i%&%60MB8$N>!<j$J%(%s%3!<%G%#%s%0$+!"e(BUTF-8 e$B$G$9$M!#e(B
e$B$3$NJU$Oe(B HTML5 [email protected]=$5$l$kM=Dj$G$9!#e(B
http://www.w3.org/TR/html5/forms.html#url-encoded-form-data

e$B:$$k$N$Oe(BGETe$B$N%/%(%j%Q%i%a!<%?$H$7$FM?$($l$kJ8;zNs$Ne(B
e$B%(%s%3!<%G%#%s%0$G!"$3$l$O%j%s%/Ey$N>l9g!"%j%s%/85$Ne(B
HTMLe$B$N%(%s%3!<%G%#%s%0$K0MB8$9$k$?$a!“F10l%Z!<%8$X$Ne(B
e$B%”%/%;%9$G$b!J%j%s%/85$,0[$J$l$P!Ke([email protected]$C$?$je(B
[email protected]$C$?$j$9$k$3$H$,$7$P$7$P$"$j$^$9!#$^$“e(B
e$B%”%W%jFb$G$O;HMQ$9$ke(BHTMLe$B$N%(%s%3!<%G%#%s%0$OGD0.!&e(B
[email protected])8f$G$-$k$O$:$J$N$G!"$=$l0J30!J30It%5%$%H$+$i$Ne(B
e$B%j%s%/$N>l9g$H$+!K$O?dB,e(B and/or e$B4V0c$C$?$i$4$a$s!"$+$J$"$H!#e(B

URL e$B<+BN$K%(%s%3!<%G%#%s%0$rKd$a9~$`$N$,@52r$G$7$g$&!#e(B

e$B$^$?!"@h$NJ8=q$Ke(B charset
e$B%Q%i%a!<%?$NOC$,$"$k$N$G!"$=$l$rN.MQ$7$F$b$h$$$+$b!#e(B
e$B$3$l$>$^$5$7$/%P%C%I%N%&%O%&$C$F46$8$G$9$,!#e(B
http://0xcc.net/pub/webdb/bk-04.html
http://suika.fam.cx/~wakaba/wiki/sw/n/charset

e$B$G$9$,!#e(B
Rails e$B$O:#[email protected]$Je(B UTF-8
e$B$,Aw$i$l$F$-$?$H$-$ONc30$r>e$2$F$$$^$;$s$C$1!#e(B

2010/4/30 Yukihiro M. [email protected]:

e$B0l$D$NNc$H$7$F$O!"%F%s%W%l!<%H$N%(%s%3!<%G%#%s%0$HKd$a9~$`J8e(B
e$B;zNse(B(e$B$?$H$($P%G!<%?%Y!<%9$+$i$N$b$Ne(B)e$B$N%(%s%3!<%G%#%s%0$,%:%le(B
e$B$F$F!"e(B

incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)

e$B$,=P$k!"$H;d$OJ9$-$^$7$?!#e(B

e$B$=$l$O%"%W%j%1!<%7%g%s$N%P%0$G$9!#%P%0$r=q$/$H%P%0$,=P$^$9$7!"%G!<%?%Y!<%9$,%+%i%$KI3IU$$$?%(%s%3!<%G%#%s%0$NBe$o$j$Ke(BASCII-8BITe$B$rJV$9$h$&$K$7$F$b2r7h$7$^$;$s!#e(B e$B:#;~$N%G!<%?%Y!<%9%7%9%F%$O%3%M%/%7%g%s$d%F!<%V%k$d%+%i%`$,%(%s%3!<%G%#%s%0$r;}$C$F$k$N$G!"$=$N%(%s%3!<%G%#%s%0$r%I%i%$%PB&$GI3$E$1$F$d$k$N$,0lHV>pJs$,Mn$A$J$/$FNI$$$H;W$$$^$9!#$=$l$Ge(BPostgreSQLe$B$N%"%@%W%?$K$O$=$&$$$&%Q%C%A$rAw$C$Fe(Baccepte$B$5$l$^$7$?!#e(B

M17Ne$B$,I,MW$J%"%W%j%1!<%7%g%s$J$i%F%s%W%l!<%H$Ke(BUS-ASCIIe$B30$NJ8;z$r=q$/$Y$-$G$J$$$7!“5U$KFCDj$N%(%s%3!<%G%#%s%0$r2>Dj$G$-$k$J$i$P%G!<%?$be(Bscript
encodinge$B$b$=$N%(%s%3!<%G%#%s%0$K9g$o$;$k$Y$-$G$9!#$=$7$F!”$=$N$$$:$l$b$,!“e(BDBMSe$BB&$GG’<1$7$F$$$k%(%s%3!<%G%#%s%0$NJ8;zNs$,JV$C$F$-$?J}$,4r$7$$H&$G$9!#e(BASCII-8BITe$B$K$9$k1W$,$I$3$K$”$k$N$+J,$+$j$^$;$s!#e(B

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

In message “Re: [ruby-dev:41109] Re: Rails3 M17N”
on Fri, 30 Apr 2010 13:23:59 +0900, masayoshi takahashi
[email protected]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k$?$a!“F10l%Z!<%8$X$Ne(B
|e$B%”%/%;%9$G$b!J%j%s%/85$,0[$J$l$P!Ke([email protected]$C$?$je(B
|[email protected]$C$?$j$9$k$3$H$,$7$P$7$P$"$j$^$9!#$^$“e(B
|e$B%”%W%jFb$G$O;HMQ$9$ke(BHTMLe$B$N%(%s%3!<%G%#%s%0$OGD0.!&e(B
|[email protected])8f$G$-$k$O$:$J$N$G!"$=$l0J30!J30It%5%$%H$+$i$Ne(B
|e$B%j%s%/$N>l9g$H$+!K$O?dB,e(B and/or e$B4V0c$C$?$i$4$a$s!"$+$J$"$H!#e(B

e$B$3$l$bA4It%"%W%j%(%s%3!<%G%#%s%0$H8+$J$7$F$bBg$-$J%@%a!<%8$Oe(B
e$B$J$5$=$&$G$9$M!#e(B

e$B$"!"$G$b!“e(BWebe$B%”%W%j$GFbIt%(%s%3!<%G%#%s%0$H30It%(%s%3!<%G%#e(B
e$B%s%0$r0[$J$k$b$N$K$7$?$$%K!<%:$C$F$I$N$/$i$$$"$k$s$G$9$+$M!#e(B
[email protected]$H$"$k$N$+$J$"!#e(B

|e$BNc30$O$$$m$$$m87$7$$$+$b!D!#e(Bvalidatione$B$N%%V%8%’%/%H$Ke(B
|e$B%(%i!<$N>pJs$,F~$C$F$F$[[email protected])8f%U%m!<$ODL>o$N$^$^!K$,e(B
|e$BM}A[E
$+$b$G$9!#$C$F!"$=$NJU$j$O%U%l!<%`%o!<%/$H$N7s$M9g$$e(B
|e$B$G$9$,!#e(B

e$B$&!<$s!"$3$NJU$Oe(B Rails
e$B$N;EAH$_$,$o$+$i$J$$$N$Ge(B(e$B$4$a$s$J$5$$e(B)e$B!"e(B
[email protected]$($^$;$s!#2DG=$J$s$G$9$+$M!#e(B

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

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

(2010/04/30 16:50), Yukihiro M. wrote:

|e$B$J$N$G!"%G!<%?%Y!<%9<~$j$G$NLdBj$O!"e(B
|DBe$B%I%i%$%P$GE,@Z$Je(Bencodinge$B$r$D$1$FJV$9e(B or force_encoding e$B$9$l$OBg>fIW$=$&$G$9!#e(B

e$B%I%i%$%P$G$d$k$Y$-$+!"%U%l!<%%o!<%/$G$d$k$Y$-$+G:$^$7$$$H$3e(B e$B$m$G$9$M!#8D?ME*$K$O!"%"%@%W%?$+%U%l!<%%o!<%/$+$$$:$l$+$GBPe(B
e$B1~$7$F!"%I%i%$%P$Oe(BASCII-8BITe$B$rJV$9$Y$-$G$O$J$$$+$H;W$$$D$D$"e(B
e$B$j$^$9!#e(B

e$B$$$m$$$m9M$($?$s$G$9$,!"[email protected]_Dj$7$me(BYO!e$B!W$C$F;XE&[email protected]$O>/$J$$J}$,$$$$$N$G!“e(B
e$B<B$O%I%i%$%[email protected]_Dj$9$k$N$,%Y%9%H$8$c$J$$$+$H;W$$$D$D$”$j$^$9!#e(B

e$BM}6~$N>e$G$b!"$=$l$,!VJ8;[email protected]$H$o$+$C$F$$$k$J$i%(%s%3!<%G%#%s%[email protected]_Dj$9$k$Y$-$J$N$G$9$,!"e(B
DB
e$B$+$i=P$F$/$k;[email protected]$GJ8;zNs$+%P%$%J%jNs$+$o$+$C$F$$$k$O$:$J$N$G!#$`$7$m!"8e9)Dx$K$J$k$He(B
varchar(xx) e$B$+$i=P$F$-$?$N$+!"e(B blob(xx)
e$B$+$i=P$F$-$?$N$+$o$+$i$J$/$J$j$^$9$7!#e(B

MySQLe$B%I%i%$%P$Oe(B pure ruby e$B$Ne(B
2.9e$B7O$J$ie(BDBe$B$N%(%s%3!<%G%#%s%0$re([email protected]_Dj$7$^$9!#e(B

2010/4/30 NARUSE, Yui [email protected]:

MySQL e$B$H$+e(B Oracle e$B$H$+$O$I$&[email protected]$C$1e(B?


OZAWA Sakuro

“The future will be better tomorrow.” --Dan Quayle

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

(2010/04/30 18:09), Yugui wrote:

e$B%(%s%3!<%G%#%s%0$NBe$o$j$Ke(BASCII-8BITe$B$rJV$9$h$&$K$7$F$b2r7h$7$^$;$s!#e(B
e$B$o$?$7$N8=:_$NM}2r$G$O!"%F%s%W%l!<%H$,e(B UTF-8
[email protected]$7$$$G$9!#e(B
e$B$3$l$Oe(B Encoding.default_external e$B$Ge(B UTF-8 e$B$Je(B String
e$B$H$7$?>e$G!"e(B
ERB e$BFb$Ge(B eval e$B$7$F$$$k$N$Ge(B UTF-8
e$B$K$J$C$F$$$k$N$G$7$g$&e(B (e$B$?$V$se(B)e$B!#e(B

e$B$D$^$j!"%F%s%W%l!<%H$Ke(B magic comment e$B$OI,$:$7$bI,MW$J$$e(B

(?)

e$B$H$$$&$o$1$G!"%G!<%?%Y!<%9$+$i$NJ8;zNs$,e(B ASCII-8BIT
e$B$K$J$C$F$$$k$N$,@dBPE*$K8m$j$G$9!#e(B

e$B:#;~$N%G!<%?%Y!<%9%7%9%F%$O%3%M%/%7%g%s$d%F!<%V%k$d%+%i%$,%(%s%3!<%G%#%s%0$r;}$C$F$k$N$G!“e(B
e$B$=$N%(%s%3!<%G%#%s%0$r%I%i%$%PB&$GI3$E$1$F$d$k$N$,0lHV>pJs$,Mn$A$J$/$FNI$$$H;W$$$^$9!#e(B
e$B$=$l$Ge(BPostgreSQLe$B$N%”%@%W%?$K$O$=$&$$$&%Q%C%A$rAw$C$Fe(Baccepte$B$5$l$^$7$?!#e(B

SQLite3 e$B$N%I%i%$%P$G$"$k!“e(Bsqlite3-ruby
e$B$b<!$N%P!<%8%g%s$G%(%s%3!<%G%#%s%0$re(B
[email protected]_Dj$9$k$h$&$K$J$j$^$9!#e(B (thanks Aaron)
Rails e$B$N%G%U%)%k%H$G$”$ke(B SQLite3
e$B$,[email protected]$C$?$N$GF’$`?M$,[email protected]$H;W$$$^$9$,!"e(B
e$B$3$l$G:#8e$O8:$C$F$$$/$s$8$c$J$$$G$7$g$&$+!#e(B

MySQL e$B$H$+e(B Oracle e$B$H$+$O$I$&[email protected]$C$1e(B?

M17Ne$B$,I,MW$J%"%W%j%1!<%7%g%s$J$i%F%s%W%l!<%H$Ke(BUS-ASCIIe$B30$NJ8;z$r=q$/$Y$-$G$J$$$7!“e(B
e$B5U$KFCDj$N%(%s%3!<%G%#%s%0$r2>Dj$G$-$k$J$i$P%G!<%?$be(Bscript encodinge$B$b$=$N%(%s%3!<%G%#%s%0$Ke(B
e$B9g$o$;$k$Y$-$G$9!#$=$7$F!”$=$N$$$:$l$b$,!“e(BDBMSe$BB&$GG’<1$7$F$$$k%(%s%3!<%G%#%s%0$NJ8;zNs$,e(B
e$BJV$C$F$-$?J}$,4r$7$$H&$G$9!#e(BASCII-8BITe$B$K$9$k1W$,$I$3$K$”$k$N$+J,$+$j$^$;$s!#e(B

e$BF10U8+$G$9!#e(B

e$BB<ED$G$9!#e(B

On 2010/04/30, at 18:20, NARUSE, Yui wrote:

e$B:#;~$N%G!<%?%Y!<%9%7%9%F%$O%3%M%/%7%g%s$d%F!<%V%k$d%+%i%$,%(%s%3!<%G%#%s%0$r;}$C$F$k$N$G!“e(B
e$B$=$N%(%s%3!<%G%#%s%0$r%I%i%$%PB&$GI3$E$1$F$d$k$N$,0lHV>pJs$,Mn$A$J$/$FNI$$$H;W$$$^$9!#e(B
e$B$=$l$Ge(BPostgreSQLe$B$N%”%@%W%?$K$O$=$&$$$&%Q%C%A$rAw$C$Fe(Baccepte$B$5$l$^$7$?!#e(B

SQLite3 e$B$N%I%i%$%P$G$"$k!"e(Bsqlite3-ruby e$B$b<!$N%P!<%8%g%s$G%(%s%3!<%G%#%s%0$re(B
[email protected]_Dj$9$k$h$&$K$J$j$^$9!#e(B (thanks Aaron)

e$B$3$NBP1~$OHs>o$K4r$7$$$G$9!#e(B

Rails e$B$N%G%U%)%k%H$G$"$ke(B SQLite3 e$B$,[email protected]$C$?$N$GF’$`?M$,[email protected]$H;W$$$^$9$,!"e(B
e$B$3$l$G:#8e$O8:$C$F$$$/$s$8$c$J$$$G$7$g$&$+!#e(B

e$B;d$O8=>u$G$O!"0J2<$N$h$&$J5!G=$re(B ActiveRecord
e$B$XCmF~$9$k$3$H$GBP=h$7$F$$$^$9!#e(B

http://gist.github.com/381834

if defined?(ActiveRecord)
class ActiveRecord::Base
def read_attribute_with_enforcing_utf8(attr_name)
v = read_attribute_without_enforcing_utf8(attr_name)
if String === v && column_for_attribute(attr_name).text?
return v.force_encoding(Encoding::UTF_8) if v.encoding ==
Encoding::ASCII_8BIT
end
return v
end
alias_method_chain :read_attribute, :enforcing_utf8

class << self
  private
  def define_read_method_with_enforcing_utf8(symbol, attr_name, 

column)
define_read_method_without_enforcing_utf8(symbol, attr_name,
column)
if column.text?
self.class_eval <<-END_DEFINITION, FILE, LINE
def #{symbol}_with_enforcing_utf8
v = #{symbol}_without_enforcing_utf8
v = v.force_encoding(Encoding::UTF_8) if v && v.encoding
== Encoding::ASCII_8BIT
return v
end
alias_method_chain :#{symbol}, :enforcing_utf8
END_DEFINITION
end
end
alias_method_chain :define_read_method, :enforcing_utf8
end
end
end


Kenta M.
OpenPGP FP = FA26 35D7 4F98 3498 0810 E0D5 F213 966F E9EB 0BCC

e$BK$r=q$-$^$7$?e(B!!
e$B!Xe(BRuby e$B5U0z$-%l%7%T!Ye(B
http://www.amazon.co.jp/dp/4798119881/mrkn-22

E-mail: [email protected]
twitter: http://twitter.com/mrkn/
blog: http://d.hatena.ne.jp/mrkn/