diff --git a/src/main/ruby/core/dir.rb b/src/main/ruby/core/dir.rb index fb5ce837a7a9..177e48087086 100644 --- a/src/main/ruby/core/dir.rb +++ b/src/main/ruby/core/dir.rb @@ -216,7 +216,7 @@ def glob(pattern, flags=0, &block) total = matches.size while index < total - Truffle::Type.encode_string matches[index], enc + matches[index] = matches[index].encode(enc) unless matches[index].encoding == enc index += 1 end end