diff --git a/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb b/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb index e880633933..c6c1c3f821 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb @@ -280,6 +280,7 @@ class Dir < Rex::Post::Dir end dir_files.each { |src_sub| + src_sub.force_encoding('UTF-8') dst_sub = src_sub.dup dst_sub.gsub!(::File::SEPARATOR, '_') # '/' on all systems dst_sub.gsub!(::File::ALT_SEPARATOR, '_') if ::File::ALT_SEPARATOR # nil on Linux, '\' on Windows