开发者

Ruby 1.9.2 Find.find encoding

I know that you can do Dir.entries('.', {:enco开发者_Go百科ding => 'utf-8'}) and it works properly, but I can't find any way to force the encoding when doing Find.find. On Windows, the first method correctly reads a filename of 舦舨.txt, and doing File.file? on the value returns true. However, doing Find.find returns ??.txt, even though ruby says its encoding is utf-8. Also, File.file? returns false.

Is there no way to set the encoding on Find.find?


Instead of

Find.find(dir)

I found

Find.find(dir.encode('utf-8'))

works

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜