Gem更新:无法将“\xE7”转换为UTF-8,从ASCII-8BIT转换到UTF-8到US-ASCII。

时间:2023-01-05 21:03:01

just ran gem update on a light use server machine that hadn't been updated in a while... and am getting loads of 'unable to convert "\x??" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for..." errors. Included is an except from console. anyone know what's going on?

只是在一个没有更新过的轻使用服务器上运行gem更新…并且正在收到大量的“不能转换”\x??“到UTF-8,从ASCII-8BIT到UTF-8到US-ASCII的…”错误。除了控制台之外,还有一个。有人知道发生了什么吗?

$ sudo gem update
Installing ri documentation for railties-3.0.4...
Installing ri documentation for minitest-2.0.2...
Installing ri documentation for net-ssh-2.1.0...
unable to convert "\xE7" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/net/ssh/authentication/pageant.rb, skipping
unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/net/ssh/buffered_io.rb, skipping
unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/net/ssh/service/forward.rb, skipping
unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for THANKS.rdoc, skipping
unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for CHANGELOG.rdoc, skipping
Installing ri documentation for rails-3.0.4...
file 'lib' not found
Installing ri documentation for rails3-generators-0.17.4...
unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping
Installing ri documentation for rdoc-3.5.3...
unable to convert U+201D from UTF-8 to US-ASCII for lib/rdoc/text.rb, skipping
unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for History.txt, skipping
Installing ri documentation for rspec-core-2.5.1...
unable to convert "\xC2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/rspec/core/subject.rb, skipping
Installing ri documentation for rspec-expectations-2.5.0...
unable to convert "\xC2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/rspec/matchers.rb, skipping
Installing ri documentation for rspec-mocks-2.5.0...
Installing ri documentation for rspec-2.5.0...
Installing ri documentation for rspec-rails-2.5.0...

4 个解决方案

#1


55  

I have had a similar issue on my Mac OS X using iTerm2 instead of the default OS X Terminal.app. The LC_CTYPE is not set properly by iTerm2, once I have added export LC_CTYPE="utf-8" to ~/.bash_profile the gem installation goes smoothly.

我在我的Mac OS X上有一个类似的问题,使用iTerm2而不是默认的OS X终端。当我添加了export LC_CTYPE="utf-8"到~/时,LC_CTYPE并没有正确地设置为iTerm2。gem安装进行得很顺利。

note: of course you can add the export to any of the other profile files

注意:当然可以将导出添加到任何其他配置文件中。

#2


16  

The combination of Daniel and werm's answers worked for me, once I also unset LC_ALL. I ended up with this:

丹尼尔和沃姆的回答对我起了作用,一旦我也把LC_ALL解开。我最后得出这样的结论:

export LC_CTYPE=en_US.UTF-8
export LANG=en_US.UTF-8
unset LC_ALL

#3


5  

Try running locale in your SSH terminal. This problem just started popping up for me. When I do locale I get this:

尝试在您的SSH终端中运行区域设置。这个问题刚刚开始出现。当我做locale,我得到这个:

LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C" 
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

The only fix I know of is to type LANG=en_US.UTF-8 every time I login through SSH.

我所知道的唯一补救办法就是输入LANG=en_US。每次我通过SSH登录时都是UTF-8。

#4


5  

I was getting this same issue w/ installing another gem and didn't know how to get around it even after adding export LC_CTYPE="utf-8" to my ~/.bash_profile. It wasn't until I ran sudo gem update after that was able to install the gem.

我得到了同样的问题w/安装了另一个gem,甚至在添加了export LC_CTYPE="utf-8"到my ~/.bash_profile之后,我也不知道如何绕过它。直到我运行sudo gem更新后才能够安装gem。

Note that I wanted to contribute this to the original accepted answer, however not enough points yet. :( Nonetheless I hope this helps someone else.

注意,我想把它贡献给最初接受的答案,但是还不够。(尽管如此,我希望这能帮助别人。

#1


55  

I have had a similar issue on my Mac OS X using iTerm2 instead of the default OS X Terminal.app. The LC_CTYPE is not set properly by iTerm2, once I have added export LC_CTYPE="utf-8" to ~/.bash_profile the gem installation goes smoothly.

我在我的Mac OS X上有一个类似的问题,使用iTerm2而不是默认的OS X终端。当我添加了export LC_CTYPE="utf-8"到~/时,LC_CTYPE并没有正确地设置为iTerm2。gem安装进行得很顺利。

note: of course you can add the export to any of the other profile files

注意:当然可以将导出添加到任何其他配置文件中。

#2


16  

The combination of Daniel and werm's answers worked for me, once I also unset LC_ALL. I ended up with this:

丹尼尔和沃姆的回答对我起了作用,一旦我也把LC_ALL解开。我最后得出这样的结论:

export LC_CTYPE=en_US.UTF-8
export LANG=en_US.UTF-8
unset LC_ALL

#3


5  

Try running locale in your SSH terminal. This problem just started popping up for me. When I do locale I get this:

尝试在您的SSH终端中运行区域设置。这个问题刚刚开始出现。当我做locale,我得到这个:

LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C" 
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

The only fix I know of is to type LANG=en_US.UTF-8 every time I login through SSH.

我所知道的唯一补救办法就是输入LANG=en_US。每次我通过SSH登录时都是UTF-8。

#4


5  

I was getting this same issue w/ installing another gem and didn't know how to get around it even after adding export LC_CTYPE="utf-8" to my ~/.bash_profile. It wasn't until I ran sudo gem update after that was able to install the gem.

我得到了同样的问题w/安装了另一个gem,甚至在添加了export LC_CTYPE="utf-8"到my ~/.bash_profile之后,我也不知道如何绕过它。直到我运行sudo gem更新后才能够安装gem。

Note that I wanted to contribute this to the original accepted answer, however not enough points yet. :( Nonetheless I hope this helps someone else.

注意,我想把它贡献给最初接受的答案,但是还不够。(尽管如此,我希望这能帮助别人。