ruby, rails gem安装错误-错误:执行gem…(编码::UndefinedConversionError)

时间:2021-05-04 08:59:42

I tried with last version with ruby, but when run gem install rails, always got an error

我尝试使用ruby的上一个版本,但是当运行gem安装rails时,总是会出现错误

ERROR:  While executing gem ... (Encoding::UndefinedConversionError)
    U+041D to IBM437 in conversion from UTF-16LE to UTF-8 to IBM437

I am using windows 8.

我正在使用windows 8。

but gem list ---local working.. only on install, my locale set english.

但是宝石清单---本地工作。只有安装,我的地区设置英语。

what kind problem is it?

这是什么问题?

2 个解决方案

#1


9  

Use this link: https://bugs.ruby-lang.org/issues/10300

使用这个链接:https://bugs.ruby-lang.org/issues/10300

They said that you need to chance the enconding at The registry.rb file:

他们说你得在登记处碰碰运气。rb文件:

Folder: Ruby2.1.0\lib\ruby\2.1.0\win32 File: registry.rb Line: 70

文件夹:Ruby2.1.0 \ lib \ ruby \ 2.1.0 \ win32文件:注册表。rb:70

- LOCALE = Encoding.find(Encoding.locale_charmap)
+ LOCALE = Encoding::UTF_8
+ #LOCALE = Encoding.find(Encoding.locale_charmap)

#2


1  

We'll need more information to solve your problem. What command are you running?

我们需要更多的信息来解决你的问题。你在运行什么命令?

The meaning of the exception is that some character in the gem is invalid in ibm437, a common 'extended ascii' encoding on Windows machines.

例外的含义是,gem中的某些字符在ibm437中是无效的,这是Windows机器上常见的“扩展ascii”编码。

You may be to work around the problem by setting your internal encoding to UTF-8. Encoding.default_internal = Encoding::UTF_8

您可以通过将内部编码设置为UTF-8来解决这个问题。Encoding.default_internal =编码::UTF_8

Would you mind adding the output a running a ruby file containing just the following:

您是否介意添加一个运行一个包含以下内容的ruby文件的输出:

p [Encoding.default_external, Encoding.default_internal, __ENCODING__, Encoding.find('filesystem'), Encoding.find('locale')]

Thanks. If you only do it in irb that's fine to.

谢谢。如果你只在irb中做,那没问题。

#1


9  

Use this link: https://bugs.ruby-lang.org/issues/10300

使用这个链接:https://bugs.ruby-lang.org/issues/10300

They said that you need to chance the enconding at The registry.rb file:

他们说你得在登记处碰碰运气。rb文件:

Folder: Ruby2.1.0\lib\ruby\2.1.0\win32 File: registry.rb Line: 70

文件夹:Ruby2.1.0 \ lib \ ruby \ 2.1.0 \ win32文件:注册表。rb:70

- LOCALE = Encoding.find(Encoding.locale_charmap)
+ LOCALE = Encoding::UTF_8
+ #LOCALE = Encoding.find(Encoding.locale_charmap)

#2


1  

We'll need more information to solve your problem. What command are you running?

我们需要更多的信息来解决你的问题。你在运行什么命令?

The meaning of the exception is that some character in the gem is invalid in ibm437, a common 'extended ascii' encoding on Windows machines.

例外的含义是,gem中的某些字符在ibm437中是无效的,这是Windows机器上常见的“扩展ascii”编码。

You may be to work around the problem by setting your internal encoding to UTF-8. Encoding.default_internal = Encoding::UTF_8

您可以通过将内部编码设置为UTF-8来解决这个问题。Encoding.default_internal =编码::UTF_8

Would you mind adding the output a running a ruby file containing just the following:

您是否介意添加一个运行一个包含以下内容的ruby文件的输出:

p [Encoding.default_external, Encoding.default_internal, __ENCODING__, Encoding.find('filesystem'), Encoding.find('locale')]

Thanks. If you only do it in irb that's fine to.

谢谢。如果你只在irb中做,那没问题。