宝石更新:在从ASCII-8BIT到UTF-8到US-ASCII的转换中无法将"\ xE7"转换为UTF-8

Mel*_*emi 38 rubygems ruby-on-rails

刚刚运行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...
Run Code Online (Sandbox Code Playgroud)

Dan*_*nha 56

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

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

  • 另外,我应该补充说```export LC_CTYPE = en_US.UTF-8```工作:) (2认同)

小智 16

一旦我也取消了LC_ALL,Daniel和werm的答案的组合对我有用.我最终得到了这个:

export LC_CTYPE=en_US.UTF-8
export LANG=en_US.UTF-8
unset LC_ALL
Run Code Online (Sandbox Code Playgroud)


wer*_*erm 5

尝试locale在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=
Run Code Online (Sandbox Code Playgroud)

我知道的唯一修复是LANG=en_US.UTF-8每次通过SSH登录时输入.

  • 在Solaris 10机器上遇到这个,我正在尝试安装ruby和rubygems.在我的〜/ .bashrc文件中,我把`LC_CTYPE = en_US.UTF-8 LANG = en_US.UTF-8导出LC_CTYPE LANG`.这让我的问题消失了. (2认同)

Jus*_*ier 5

我有同样的问题w /安装另一个宝石,并不知道如何解决它,即使添加export LC_CTYPE="utf-8"到我的~/.bash_profile.直到我跑完sudo gem update之后才能安装宝石.

请注意,我想将其贡献给原始接受的答案,但还不够.:(尽管如此,我希望这有助于其他人.