0

On Windows 10 using the Cygwin environment, I get the following error:

 $ gem list
 ERROR:  Loading command: list (ArgumentError)
      unknown encoding name - CP20127
 ERROR:  While executing gem ... (NoMethodError)
      undefined method `invoke_with_build_args' for nil:NilClass

I have

 $ gem --version
 3.0.    
 $ ruby --version
 ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-cygwin]
 $ echo $LANG
 en_GB

running in a mintty terminal (version 3.1.6)

I haven't used the gem command for months. It did work once, but of course any of the components involved, have been updated in between several times. I don't know where the encoding CP20127 comes from. It does not look like a valid encoding name or Windows code page name to me, but it indeed seems to be Windows is using:

$ chcp
Aktive Codepage: 20127

I never fiddled around with the code page and I wonder where this setting could come from, and why it could affect my gem command.

UPDATE

I tried the following:

chcp 850

After this, gem list works. Hence, the culprit was the codepage setting. Now my question: Since I never explicitly set the codepage anywhere, what could the most likely reason be for the incorrect codepage setting?

UPDATE 2

I found meanwhile that CP20127 is set by mintty, while in another terminal (say, the normal Windows command console, or the conemu console, my shell has CP850. I also found that CP65001 (Unicode Codepage) does not break the gem command.

JörgWMittag pointed out in his comment, that CP20127 is the ASCII codepage, so I wonder why the gem command does not work with it. In other words: Is it a bug in gem (because it should not bail out with this CP), or is it a bug in mintty (because it sets this CP), or do I miss something else?

user1934428
  • 19,864
  • 7
  • 42
  • 87

0 Answers0