[Mac OS X] Dir.glob で取得したファイル名のバイト列が異なる

Ruby 2.0 $B$^$G$O(B OS X $B$N%U%!%$%kL>$r(B Dir.glob
$B$G<[email protected]$7$?$H$-$K$O(B
OS X $B%U%!%$%k%7%9%F%`$,JV$9(B Normalization Form D $B%P%$%HNs$,(B
Dir.glob $B$G(B
$B<[email protected]$5$l$F$*$j$^$7$?!#(B

Ruby 2.1 $B$+$i$O(B Normalization Form C $B$KJQ49$7$?%P%$%HNs$,(B
Dir.glob $B$G(B
$B<[email protected]$5$l$k$h$&$K$J$C$F$$$k$h$&$J$N$G$9$,!";EMM$,JQ$o$C$?$N$G$7$g$&$+!)(B

% cat test.rb
system “touch ‘$B$,(B’”
Dir.glob("*").each do |file|
next if file == $0
puts “** #{file} **”
file.each_byte do |b|
p b
end
end

% ruby -v test.rb
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
** $B$,(B **
227
129
139
227
130
153

% ruby -v test.rb
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
** $B$,(B **
227
129
140

$BC<E*$K$O;EMMJQ99$G$9!#(B
[email protected]$N2L$F$KJQ99$5$l$?$o$1$J$N$G$9$,!">:Y$r$9$0$K$O;W$$=P$;$J$$$N$G!"(B
$B$5$7$"$?$C$F$O(B http://bugs.ruby-lang.org/issues/7267
$B$r8fMw$/[email protected]$5$$!#(B
[email protected]$,I,[email protected]$7$^$9!#(B

2014$BG/(B1$B7n(B3$BF|(B 16:33 Watson [email protected]:

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

$B;EMMJQ99$H$$$&$3$H$J$N$G!":#8e:F$S?6$kIq$$$,JQ$o$k$3$H$,$J$5$=$&$J$N$G!"(B
$B8=:_!";d$,Ax6x$7$F$$$kLdBj$K$D$$$F$O$3$A$i$GBP=h$7$?$$$H;W$$$^$9!#(B

$B$"$j$,$H$&$4$6$$$^$7$?!#(B

OS X$B$N(BHFS+$B>e$N%U%!%$%kL>$r(BRuby$B$G$I$&07$&$Y$-$+$K$D$$$F$O!"(B
$B:#$G$bCN8+$,==J,[email protected][email protected]$$Fq$$$N$G!"(B
$B$I$N$h$&$JLdBj$KAx6x$7$?$N$+6&[email protected]$1$k$H=u$+$j$^$9!#(B

2014$BG/(B1$B7n(B9$BF|(B 10:02 Watson [email protected]:

$B!V%U%!%$%k$,B8:_$9$k$+!W$N%A%’%C%/$G$7$?$i!"(BDir.glob$B$G<[email protected]$7$?$b$N$HHf3S$G$O$J$/!"(B
File.exist?($B%U%!%$%kL>(B)$B$NJ}$,$$$$$G$9$h!#(B

2.1$B$N(BString#encode$B$O0lDL$j3NG’$7$F<B:]$N%U%!%$%k%7%9%F%`$HF1$8$h$&$KF0$/$h$&$K$7$?$D$b$j$G$9$,!"(B
$B>-Mh$N%P!<%8%g%s$G5sF0$,[email protected]$O$"$j$^$9$7!"(B
HFS+$B$ODL>o(Bcase
insensitive$B$G%^%&%s%H$5$l$^$9$+$i!"(BHFS+$B$HF1$8(Bcase
insensitive$B$JHf3S$bI,MW$G$9!#(B
$B$G!"$b$A$m$s(Bcase sensitive$B$G%^%&%s%H$5$l$k$3$H$b$"$j$($^$9!#(B

$B$J$I$r9MN8$9$k$H!"AGD>$K%U%!%$%k%7%9%F%`$KJ9$/$N$,0lHV$G$9!#(B

2014$BG/(B1$B7n(B9$BF|(B 10:17 Watson [email protected]:

RubyMotion $B$G(B iOS/OSX $B%"%W%j$r%S%k%I$9$k:]$K(B CRuby
$B$r;HMQ$7$F$$j$^$9!#(B
$B%S%k%I$9$kESCf$G!"%f!<%6$,;XDj$7$?%"%W%jL>$N%U%!%$%k$,B8:_$7$F$$$k$+(B
$B%A%’%C%/$9$k=hM}$,$"$j!"(BDir.glob
$B$rMQ$$$F%U%!%$%kL>$r<[email protected]$7$F$
$j$^$9!#(B

$B0JA0(B String#encode $B$G(B Normalization Form D $B$+$i(B
Normalization Form C $B$X(B
$BJQ49$G$-$J$$LdBj$,$"$jJs9p$7$F$*$j$^$9!#(B
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/47680

$B$=$N$?$a!"%f!<%6$,%"%W%j$r%S%k%I$9$k:]$K(B CRuby 1.8$B!"(B1.9 $B$d(B
2.0 $B$rMxMQ$7(B
$B$F$$$F$b(B
$BF0$/$h$&$K%U%!%$%kL>$r07$&2U=j$r(B Normalization Form D
$B$GE}0l$7$F$$$?$?$a!"(B
$B:#2sJs9p$7$?FbMF$K$D$$$FAx6x$7$?<!Bh$G$9!#(B

Ruby 2.1.0 の NEW に Dir.glob の仕様変更について記載がないようなので、
追記していただければ同様のことで苦しまれる方が減るのかと思われます。

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