Actions
Bug #11320
closedreopening stdio streams with non-ANSI filenames fails on Windows
Description
fname = 'ルビー'
File.write(fname, '')
p File.exist?(fname)
$stdin.reopen(fname, 'r')
It fails with Errno::ENOENT
on Windows even though the file exists and is readable. It's caused by using freopen()
(https://github.com/ruby/ruby/blob/v2_2_2/io.c#L6765). A wrapper that converts to UTF-16LE and then calls wfreopen()
has to be added to win32/win32.c
.
Updated by nobu (Nobuyoshi Nakada) almost 9 years ago
- Status changed from Open to Closed
Applied in changeset r51069.
io.c: reopen OS encoding path
- io.c (rb_io_reopen): freopen(3) with OS encoding path.
[ruby-core:69780] [Bug #11320] - win32/file.c (rb_freopen): wrapper of wchar version freopen(3).
use _wfreopen_s() if available.
Actions
Like0
Like0