Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Guarantee BINARY encoding of gems that have been fetched

This fixes a gem installation issue that looked like:
{{{
ERROR:  While executing gem ... (IndexError)
    You can't cut a surrogate in two in an encoding that is not UTF-16
}}}

Committing on behalf of @vincentisambart
  • Loading branch information...
commit 39b9c3bd60e9f8f5d2dfc9880684a723ff0f227c 1 parent a6c7ffb
Mark Rada ferrous26 authored

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. +3 1 lib/rubygems/remote_fetcher.rb
4 lib/rubygems/remote_fetcher.rb
@@ -277,7 +277,9 @@ def open_uri_or_path(uri, last_modified = nil, head = false, depth = 0)
277 277 raise Gem::RemoteFetcher::FetchError.new('error when fetching data', uri)
278 278 end
279 279 say "OK" if Gem.configuration.really_verbose
280   - return String.new(data)
  280 + data = String.new(data)
  281 + data.force_encoding(Encoding::BINARY)
  282 + return data
281 283
282 284 raise "block is dead" if block_given?
283 285

0 comments on commit 39b9c3b

Please sign in to comment.
Something went wrong with that request. Please try again.