From: Luis Lavena Date: 2012-03-01T03:51:05+09:00 Subject: [ruby-core:43028] [ruby-trunk - Bug #6104] File.join always returns as ASCII-8BIT regardless of input encoding Issue #6104 has been updated by Luis Lavena. Category set to core Assignee set to Usaku NAKAMURA Patrick, Actually as I described in #5297, the error is not File.join but the result of Dir.glob coming using the current Encoding.default_external and not the filesystem one:
V:\>chcp 1252
Active code page: 1252

V:\>ruby -e "puts Dir.glob('*').first.encoding"
Windows-1252

V:\>chcp 437
Active code page: 437

V:\>ruby -e "puts Dir.glob('*').first.encoding"
IBM437
While File.expand_path is more smart about that.
V:\>chcp 1252
Active code page: 1252

V:\>ruby -e "puts File.expand_path('.').encoding"
Windows-1252

V:\>chcp 437
Active code page: 437

V:\>ruby -e "puts File.expand_path('.').encoding"
Windows-1252
---------------------------------------- Bug #6104: File.join always returns as ASCII-8BIT regardless of input encoding https://bugs.ruby-lang.org/issues/6104 Author: Patrick Bennett Status: Open Priority: Normal Assignee: Usaku NAKAMURA Category: core Target version: 1.9.3 ruby -v: ruby 1.9.3p125 (2012-02-16) [i386-mingw32] I can show lots of different variations, but the simplest proof is: irb(main):001:0> File.join('foo'.encode('utf-8')).encoding => # -- http://bugs.ruby-lang.org/