Linux Ruby on Rails - 无法将“\x89”从 ASCII-8BIT 转换为 xxx/xxxx/xxxx 的 UTF-8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18235293/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:32:50  来源:igfitidea点击:

Ruby on Rails - unable to convert "\x89" from ASCII-8BIT to UTF-8 for xxx/xxxx/xxxx

ruby-on-railsrubylinuxrubygemsinstallation

提问by nerdiplayboy

I am installing ruby on rails 4.0.0 on my linux system , but i am getting this kind of errors unable to convert "\x89" from ASCII-8BIT to UTF8 for guides/assets/images/getting_started/routing_error_no_route_matches.png, skippingand many similar errors , i read herethat it won't cause any effect ,but i do not understand why it is coming . Any pointers?

我正在我的 linux 系统上的 rails 4.0.0 上安装 ruby​​,但是我遇到了这种错误,无法将“\x89”从 ASCII-8BIT 转换为 UTF8 以获取指南/资产/图像/getting_started/routing_error_no_route_matches.png,跳过和许多类似的错误,我在这里读到它不会造成任何影响,但我不明白它为什么会出现。任何指针?

回答by Vitaliy Yanchuk

Set such environment variables before you do install:

在安装之前设置这样的环境变量:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

回答by Brian

You need to update / install a version of the rdoc gem that supports the conversion. Then these errors won't appear during generation of the documentation when you install rails or when you regenerate the documentation.

您需要更新/安装支持转换的 rdoc gem 版本。然后,当您安装 rails 或重新生成文档时,这些错误将不会在生成文档期间出现。

gem install rdoc

Then to regenerate the documentation

然后重新生成文档

gem rdoc --all --overwrite

回答by coberlin

If you prefer using online documentation to using rdoc and ri, then you can avoid these errors and speed up your installs by skipping the rdoc and ri installations. Michael Hartl recommends this in his book. Just add a .gemrc file to your home directory with the following contents:

如果您更喜欢使用在线文档而不是使用 rdoc 和 ri,那么您可以通过跳过 rdoc 和 ri 安装来避免这些错误并加快安装速度。Michael Hartl 在他的书中推荐了这一点。只需将 .gemrc 文件添加到您的主目录,并包含以下内容:

install: --no-rdoc --no-ri
update: --no-rdoc --no-ri