From: Greg.mpls@... Date: 2019-08-01T14:06:32+00:00 Subject: [ruby-core:94098] [Ruby master Bug#15993] 'require' doesn't work if there are Cyrillic chars in the path to Ruby dir Issue #15993 has been updated by MSP-Greg (Greg L). On a US Windows system, I used a base Ruby folder of `C:\Greg\Ruby ������` (using a space and Cyrillic characters), and I could repo the issue. Without any console chcp command, I did the following, which also solved the issue: ```ruby # start ruby with --disable=gems $:.map! { |path| path.dup.force_encoding 'UTF-8' } require 'rubygems' require 'openssl' puts OpenSSL::VERSION ``` I don't think spaces in Windows paths is an issue anymore, but I haven't rigorously checked... ---------------------------------------- Bug #15993: 'require' doesn't work if there are Cyrillic chars in the path to Ruby dir https://bugs.ruby-lang.org/issues/15993#change-80331 * Author: inversion (Yura Babak) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- I���m trying to build a cross-platform portable application with Ruby onboard and there is a problem on Windows. A user usually installs it to the Roaming folder which sits inside a user folder which can often have not a Latin name or contain spaces). When there is a Cyrillic character (maybe just not Latin) in the path ��� require of any gem doesn���t work: ``` D:\users\������\Ruby\2.6\bin>ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32] D:\users\������\Ruby\2.6\bin>ruby -e "require 'logger'" Traceback (most recent call last): 1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>' <internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/�������������/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError) D:\users\������\Ruby\2.6\bin>ruby --disable=rubyopt -e "require 'logger'" Traceback (most recent call last): 1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>' <internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/�������������/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError) D:\users\������\Ruby\2.6\bin>gem list Traceback (most recent call last): 1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>' <internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/�������������/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError) ``` We can see such encoding transformations in the output: ``` ������ (utf-8) == ������������� (win1251) ``` I have an old Ruby installation that works fine: ``` D:\users\������\Ruby\2.0\bin>ruby -e "require 'logger'" D:\users\������\Ruby\2.0\bin>ruby -v ruby 2.0.0p451 (2014-02-24) [i386-mingw32] ``` The same is for `ruby 2.0.0p643 (2015-02-25) [i386-mingw32]` . I also checked that require fails in the same case for `ruby 2.1.9p490 (2016-03-30 revision 54437) [i386-mingw32]` -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>