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

只是在一段时间没有gem update的光使用服务器机器上运行gem update …并且正在获取“无法转换”的负载\ 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... 

我在使用iTerm2而不是默认的OS X Terminal.app的Mac OS X上遇到类似的问题。 iTerm2没有正确设置LC_CTYPE,一旦将export LC_CTYPE="utf-8"到〜/ .bash_profile中,gem的安装就会顺利进行。

注意:当然,您可以将导出添加到任何其他profile文件

Daniel和werm的答案的结合对我来说,一旦我也取消LC_ALL。 我结束了这个:

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

尝试在SSHterminal中运行locale 。 这个问题刚刚开始为我popup。 当我做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= 

我唯一的解决方法是每次通过SSHlogin时键入LANG=en_US.UTF-8

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

请注意,我想对原始接受的答案作出贡献,但是还没有足够的分数。 :(但我希望这可以帮助别人。