安装 gem 时无法将"x89"从 ASCII-8BIT 转换为 UTF-8 xxx



我目前正在写一个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

我在其他地方看到了类似的问题,但是在尝试安装它时,它们都是针对特定的宝石的。我要问的是我如何修复我的宝石,以免产生此错误?

这是我的宝石规格

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 密切相关 --no-document"可以作为临时解决方案。

相关内容

最新更新