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$K$J$j$^$9e(B)
#e$B$r?)$o$;$F$$$F!"!V%9%/%j%W%H$,4|BTDL$jF0$-$^$;$s!#%P%0$G$9$+!We(B
#e$B$H$$$&Ld$$9g$o$;[email protected]$$$?$3$H$,$"$j$^$7$F$A$g$C$H5$$K$J$C$F$^$9e(B

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

In message Re: [ruby-dev:32979] BOM of UTF-e$B#8e(B
on Mon, 7 Jan 2008 23:21:24 +0900, KIMURA Koichi
[email protected] writes:

|[email protected]$$NCf$K$O:$$C$?$3$H$Ke(BBOM(e$B$re(BUTF-8e$B7A<0$K%(%s%3!<%I$7$?e(B)e$B$,$/$C$D$$$?e(B
|UTF-8e$B%F%-%9%H$H$$$&$b$N$,B8:_$7$F$$$?$j$7$^$9$,!"$3$l$Ne(BBOMe$B$N07$$e(B
|e$B$H$$$&$O8=>uDL>o$NJ8;z$HF1$8$GFI$_9~$`:]$KFC$K<h$j=|$/$h$&$J$3$H$Oe(B
|e$B$7$F$$$J$$$H;W$&$N$G$9$,$3$l$O$"$C$F$^$9$+e(B?
|#e$B$$$A$*$&%=!<%9$O8+$^$7$?$,e(B

e$B$7$F$$$^$;$s!#e(B

|e$B$D$.$K8=>u$Ge(Bdont care e$B$G$"$k$H$7$F!"$=$l$O;EMM$H$7$Fe(B(e$B$H$j$"$($:$Ne(B
|e$B7A$G$"$C$F$be(B)e$B8GDj$5$l$?$b$N$G$9$+e(B?

e$B>[email protected]$9$k$[$I$G$O$J$$$G$9$,!BP1~$9e(B
e$B$kM=Dj$O$$j$^$;$s!#e(B

|e$B$3$l$O$D$^$je(B
|
|ARGF.readlines.each do |x|
| puts x if /^\d\d\d/.match(x)
|end
|
|e$B$N$h$&$K=hM}$7$h$&$H$7$?$H$-$K!"%U%!%$%[email protected],$N9T$K$D$$$Fe(BBOMe$B$Ne(B
|e$B07$$$O%f!<%6!<$,$h$m$7$/$d$l$H$$$&J}?K$+$I$&$+$H$$$&$3$H$G$9!#e(B

e$B$=$&$$$&$3$H$G$9$M!#$"$k$$$Oe(BBOM
awaree$B$Je(Bopene$B$rDs6!$9$k%i%$%Ve(B
e$B%i%j$,EP>l$9$k$+$b$7$l$^$;$s$,!#e(B

|#e$BK?e(Bgawke$B$G!e(BBOMe$B$D$-e(BUTF-8e$B%F%-%9%He(B(e$B%a%bD$G:n$k$H$b$l$J$/e(BBOMe$B$D$-$K$J$j$^$9e(B)
|#e$B$r?)$o$;$F$$$F!"!V%9%/%j%W%H$,4|BTDL$jF0$-$^$;$s!#%P%0$G$9$+!We(B
|#e$B$H$$$&Ld$$9g$o$;[email protected]$$$?$3$H$,$"$j$^$7$F$A$g$C$H5$$K$J$C$F$^$9e(B

e$B!V%a%bD"$N%P%[email protected]$$$?$$$H$3$m$G$9$M!#8@$$$^$;$s$,!#e(B

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

e$BLZB<$G$9!#e(B

e$B$^$D$b$H$5$s!"@[email protected]%$5$s2sEz$"$j$,$H$&$4$6$$$^$9!#e(B
e$BJ}?K$ON;2r$7$^$7$?!#e(B

Yukihiro M. e$B$5$s$O=q$-$^$7$?e(B (2008/01/07 23:55):

|e$B$N$h$&$K=hM}$7$h$&$H$7$?$H$-$K!"%U%!%$%[email protected],$N9T$K$D$$$Fe(BBOMe$B$Ne(B
|e$B07$$$O%f!<%6!<$,$h$m$7$/$d$l$H$$$&J}?K$+$I$&$+$H$$$&$3$H$G$9!#e(B

e$B$=$&$$$&$3$H$G$9$M!#$"$k$$$Oe(BBOM awaree$B$Je(Bopene$B$rDs6!$9$k%i%$%Ve(B
e$B%i%j$,EP>l$9$k$+$b$7$l$^$;$s$,!#e(B

e$B$J$k$[$I!#N;2r$G$9!#e(B

|#e$BK?e(Bgawke$B$G!e(BBOMe$B$D$-e(BUTF-8e$B%F%-%9%He(B(e$B%a%bD$G:n$k$H$b$l$J$/e(BBOMe$B$D$-$K$J$j$^$9e(B)
|#e$B$r?)$o$;$F$$$F!"!V%9%/%j%W%H$,4|BTDL$jF0$-$^$;$s!#%P%0$G$9$+!We(B
|#e$B$H$$$&Ld$$9g$o$;[email protected]$$$?$3$H$,$"$j$^$7$F$A$g$C$H5$$K$J$C$F$^$9e(B

e$B!V%a%bD"$N%P%[email protected]$$$?$$$H$3$m$G$9$M!#8@$$$^$;$s$,!#e(B

e$B%a%bD"$N%P%[email protected]$$$^$;$s$G$7$?$,!"e(BBOMe$B$D$1$J$$%(%G%#%?$G%F%-%9%H$re(B
e$B:n$C$F$/$l$H$$$&$3$H$GG<[email protected]$7$F$b$i$$$^$7$?!#e(B

NARUSE, Yui e$B$5$s$O=q$-$^$7$?e(B (2008/01/08 0:02):

e$B;EMM$NOC$r=P$7$F$*$/$H!e(BUTF-8 e$B$Oe(B RFC 3629 e$B$J$s$G$9$,!e(B6. Byte order
mark (BOM) e$B$G>!<j$Ke(B BOM e$B$r<N$F$A$c$&$N$O$^$:$$$+$b!$H$$$C$?$h$&$J$3$H$,e(B
e$B=q$$$F$$j$^$9!#e(B
e$B!He(BRECOMMENDED to avoid stripping an initial U+FEFFe$B!Ie(B
http://www.ietf.org/rfc/rfc3629.txt

e$B$b$C$H$b!e(Bnkf e$B$G$Oe(B ZERO WIDTH NO-BREAK SPACE e$B$J$s$+;H$C$F$k?M4V$$$M!<e(B
e$B$h!$C$F$3$H$G<N$F$A$c$C$F$^$9$1$I!#e(B

e$B$O$$!#?!9;v>p$,$"$C$F!e(BBOMe$B$$$i$M!<$GFI$_Ht$P$9$N$bLdBj$J$$$o$1$G$O$J$$e(B
e$B$H$$$&$N$Oe(B
xgawke$B$N3+H/<TO[email protected]$C$F$^$7$?!#<+J,$H$7$F$OJ}?K$,[email protected]$Ke(B
e$B$J$C$F$$$Fe(Bwork around
e$B$,Ds<($G$-$l$P$$$$$H;W$C$F$^$7$?$N$G:#2s$N2sEz$Ge(B
e$BITK~$O$"$j$^$;$s!#e(B

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

KIMURA Koichi wrote:

BOMe$B$H$+e(BUTF-16e$B$H$+!8D?ME*$K<:[email protected]$C$?$H;W$C$F$$$k5,3J$r1~1g$7e(B
e$B$?$j!@Q6KE*$K;Y1g$7$?$j$9$k5$$K$J$l$^$;$s!#e(B

e$B$H$$$&$3$H$GMM;R8+$H$$$&$3$H$G$7$g$&$+e(B?
#e$BK?e(Bgawke$B$G!e(BBOMe$B$D$-e(BUTF-8e$B%F%-%9%He(B(e$B%a%bD$G:n$k$H$b$l$J$/e(BBOMe$B$D$-$K$J$j$^$9e(B)
#e$B$r?)$o$;$F$$$F!"!V%9%/%j%W%H$,4|BTDL$jF0$-$^$;$s!#%P%0$G$9$+!We(B
#e$B$H$$$&Ld$$9g$o$;[email protected]$$$?$3$H$,$"$j$^$7$F$A$g$C$H5$$K$J$C$F$^$9e(B

e$B;EMM$NOC$r=P$7$F$*$/$H!e(BUTF-8 e$B$Oe(B RFC 3629
e$B$J$s$G$9$,!e(B6. Byte order
mark (BOM) e$B$G>!<j$Ke(B BOM
e$B$r<N$F$A$c$&$N$O$^$:$$$+$b!$H$$$C$?$h$&$J$3$H$,e(B
e$B=q$$$F$$j$^$9!#e(B
e$B!He(BRECOMMENDED to avoid stripping an initial U+FEFFe$B!Ie(B
http://www.ietf.org/rfc/rfc3629.txt

e$B$b$C$H$b!e(Bnkf e$B$G$Oe(B ZERO WIDTH NO-BREAK SPACE
e$B$J$s$+;H$C$F$k?M4V$$$M!<e(B
e$B$h!$C$F$3$H$G<N$F$A$c$C$F$^$9$1$I!#e(B

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