安装时无法将“\x89”从 ASCII-8BIT 转换为 UTF-8 xxx gem
unable to convert "\x89" from ASCII-8BIT to UTF-8 xxx when installing gem
我目前正在写一篇 gem,由于某些原因需要包含 WordPress 的完整副本(不完全确定这是否相关)。
现在,问题; 运行 gem 构建正常,但 gem 安装给出此错误消息似乎是针对每个二进制文件(.gif、.png 等),并且经过一些错误,进程暂停。
unable to convert "\x89" from ASCII-8BIT to UTF-8 xxx/xxx.xx
某些邮件的 'x89' 标识符不同。
这是一个示例
unable to convert "\xF2" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/spinner.gif, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/stars-2x.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/stars.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/w-logo-blue.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/w-logo-white.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wheel.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wordpress-logo.png, skipping
unable to convert "\xF7" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wpspin_light-2x.gif, skipping
unable to convert "\xF5" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wpspin_light.gif, skipping
unable to convert "\xF6" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/xit-2x.gif, skipping
unable to convert "\xF3" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/xit.gif, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/yes.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/plugins/akismet/_inc/img/logo-full-2x.png, skipping
unable to convert "\xE8" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/genericons/Genericons.eot, skipping
unable to convert "\xFC" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/genericons/Genericons.woff, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/screenshot.png, skipping
unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfourteen/genericons/Genericons-Regular.otf, skipping
我在进程停止前得到的最后一行是
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-includes/js/mediaelement/bigplay.png, skipping
我在其他地方看到过类似的问题,但在尝试安装时,它们都是针对特定 gem 的。
我想问的是如何修复我的 gem 以便不产生此错误?
这是我的gem规格
require File.expand_path(File.dirname(__FILE__)) + '/lib/gemname.rb'
Gem::Specification.new do |s|
s.name = 'gemname'
s.version = Gemname::VERSION
s.executables << 'gemname'
s.licenses = ['LICENSE']
s.summary = "Short description"
s.description = "Long description"
s.authors = ["Sigurd Berg Svela"]
s.email = 'sigurdbergsvela@gmail.com'
s.files = `git ls-files -- lib/*`.split("\n")
s.homepage = 'https://github.com/sigurdsvela/gemname'
s.required_ruby_version = '>= 2.0.0'
gemRootDir = File.dirname(File.expand_path(__FILE__))
# get an array of submodule dirs by executing 'pwd' inside each submodule
`git submodule --quiet foreach pwd`.split("\n").each do |submodule_path|
# for each submodule, change working directory to that submodule
Dir.chdir(submodule_path) do
# issue git ls-files in submodule's directory
submodule_files = `git ls-files`.split("\n")
# prepend the submodule path to create absolute file paths
submodule_files_fullpaths = submodule_files.map do |filename|
"#{submodule_path}/#{filename}"
end
# remove leading path parts to get paths relative to the gem's root dir
# (this assumes, that the gemspec resides in the gem's root dir)
submodule_files_paths = submodule_files_fullpaths.map do |filename|
filename.gsub "#{gemRootDir}/", ""
end
# add relative paths to gem.files
s.files += submodule_files_paths
end
end
# Hardcode include gitignores submodule
Dir.chdir(Boot.dir + "/templates/gitignores") do
submodule_path = Boot.dir + "/templates/gitignores"
# issue git ls-files in submodule's directory
submodule_files = `git ls-files`.split("\n")
# prepend the submodule path to create absolute file paths
submodule_files_fullpaths = submodule_files.map do |filename|
"#{submodule_path}/#{filename}"
end
# remove leading path parts to get paths relative to the gem's root dir
# (this assumes, that the gemspec resides in the gem's root dir)
submodule_files_paths = submodule_files_fullpaths.map do |filename|
filename.gsub "#{gemRootDir}/", ""
end
# add relative paths to gem.files
s.files += submodule_files_paths
end
end
这似乎是 gem 安装程序的错误。
但是 'gem install germane --no-document' 可以作为临时解决方案。
我目前正在写一篇 gem,由于某些原因需要包含 WordPress 的完整副本(不完全确定这是否相关)。 现在,问题; 运行 gem 构建正常,但 gem 安装给出此错误消息似乎是针对每个二进制文件(.gif、.png 等),并且经过一些错误,进程暂停。
unable to convert "\x89" from ASCII-8BIT to UTF-8 xxx/xxx.xx
某些邮件的 'x89' 标识符不同。
这是一个示例
unable to convert "\xF2" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/spinner.gif, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/stars-2x.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/stars.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/w-logo-blue.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/w-logo-white.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wheel.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wordpress-logo.png, skipping
unable to convert "\xF7" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wpspin_light-2x.gif, skipping
unable to convert "\xF5" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/wpspin_light.gif, skipping
unable to convert "\xF6" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/xit-2x.gif, skipping
unable to convert "\xF3" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/xit.gif, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-admin/images/yes.png, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/plugins/akismet/_inc/img/logo-full-2x.png, skipping
unable to convert "\xE8" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/genericons/Genericons.eot, skipping
unable to convert "\xFC" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/genericons/Genericons.woff, skipping
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfifteen/screenshot.png, skipping
unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-content/themes/twentyfourteen/genericons/Genericons-Regular.otf, skipping
我在进程停止前得到的最后一行是
unable to convert "\x89" from ASCII-8BIT to UTF-8 for lib/templates/wordpress/wp-includes/js/mediaelement/bigplay.png, skipping
我在其他地方看到过类似的问题,但在尝试安装时,它们都是针对特定 gem 的。 我想问的是如何修复我的 gem 以便不产生此错误?
这是我的gem规格
require File.expand_path(File.dirname(__FILE__)) + '/lib/gemname.rb'
Gem::Specification.new do |s|
s.name = 'gemname'
s.version = Gemname::VERSION
s.executables << 'gemname'
s.licenses = ['LICENSE']
s.summary = "Short description"
s.description = "Long description"
s.authors = ["Sigurd Berg Svela"]
s.email = 'sigurdbergsvela@gmail.com'
s.files = `git ls-files -- lib/*`.split("\n")
s.homepage = 'https://github.com/sigurdsvela/gemname'
s.required_ruby_version = '>= 2.0.0'
gemRootDir = File.dirname(File.expand_path(__FILE__))
# get an array of submodule dirs by executing 'pwd' inside each submodule
`git submodule --quiet foreach pwd`.split("\n").each do |submodule_path|
# for each submodule, change working directory to that submodule
Dir.chdir(submodule_path) do
# issue git ls-files in submodule's directory
submodule_files = `git ls-files`.split("\n")
# prepend the submodule path to create absolute file paths
submodule_files_fullpaths = submodule_files.map do |filename|
"#{submodule_path}/#{filename}"
end
# remove leading path parts to get paths relative to the gem's root dir
# (this assumes, that the gemspec resides in the gem's root dir)
submodule_files_paths = submodule_files_fullpaths.map do |filename|
filename.gsub "#{gemRootDir}/", ""
end
# add relative paths to gem.files
s.files += submodule_files_paths
end
end
# Hardcode include gitignores submodule
Dir.chdir(Boot.dir + "/templates/gitignores") do
submodule_path = Boot.dir + "/templates/gitignores"
# issue git ls-files in submodule's directory
submodule_files = `git ls-files`.split("\n")
# prepend the submodule path to create absolute file paths
submodule_files_fullpaths = submodule_files.map do |filename|
"#{submodule_path}/#{filename}"
end
# remove leading path parts to get paths relative to the gem's root dir
# (this assumes, that the gemspec resides in the gem's root dir)
submodule_files_paths = submodule_files_fullpaths.map do |filename|
filename.gsub "#{gemRootDir}/", ""
end
# add relative paths to gem.files
s.files += submodule_files_paths
end
end
这似乎是 gem 安装程序的错误。 但是 'gem install germane --no-document' 可以作为临时解决方案。