diff --git a/lib/fluent/file_wrapper.rb b/lib/fluent/file_wrapper.rb index 383862671f..3e4fe19784 100644 --- a/lib/fluent/file_wrapper.rb +++ b/lib/fluent/file_wrapper.rb @@ -47,9 +47,11 @@ class WindowsFile INVALID_HANDLE_VALUE = -1 - def initialize(path, mode='r') + def initialize(path, mode_enc='r') @path = path + mode, enc = mode_enc.split(":", 2) @io = File.open(path, mode2flags(mode)) + @io.set_encoding(enc) if enc @file_handle = Win32API._get_osfhandle(@io.to_i) @io.instance_variable_set(:@file_index, self.ino) def @io.ino