Issue #6104 has been updated by Luis Lavena.


Disregard previous comment, the issue with Dir.glob is something different.

<pre>
irb(main):001:0> a = "foo"
=> "foo"
irb(main):002:0> a.encoding
=> #<Encoding:Windows-1252>
irb(main):003:0> File.join(a).encoding
=> #<Encoding:ASCII-8BIT>
</pre>

And more:

<pre>
irb(main):005:0> a = "a".encode(Encoding::UTF_8)
=> "a"
irb(main):006:0> b = "b".encode(Encoding::UTF_8)
=> "b"
irb(main):007:0> a.encoding
=> #<Encoding:UTF-8>
irb(main):008:0> b.encoding
=> #<Encoding:UTF-8>
irb(main):009:0> File.join(a, b).encoding
=> #<Encoding:ASCII-8BIT>
</pre>
----------------------------------------
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
=> #<Encoding:ASCII-8BIT>



-- 
http://bugs.ruby-lang.org/