Skip to content
Browse files

- The encoding of a gem's YAML spec is now UTF-8. Issue #149

  • Loading branch information...
1 parent a43b6b2 commit 0825eb33a1f53ae6b5eee0c3a34b832c5837c04b @drbrain drbrain committed Aug 8, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/rubygems/package/tar_input.rb
View
9 lib/rubygems/package/tar_input.rb
@@ -49,8 +49,13 @@ def initialize(io, security_policy = nil)
sio.rewind
end
- # TODO use Gem.gunzip
- gzis = Zlib::GzipReader.new(sio || entry)
+ # Ruby 1.8 doesn't have encoding and YAML is UTF-8
+ args = [sio || entry]
+ args << { :external_encoding => Encoding::UTF_8 } if
+ Object.const_defined?(:Encoding)
+
+ gzis = Zlib::GzipReader.new(*args)
+
# YAML wants an instance of IO
@metadata = load_gemspec(gzis)
has_meta = true

2 comments on commit 0825eb3

@baburdick

Is there no test for this commit?

@drbrain
RubyGems member

Nope.

By the time I had dug through the guts of the nearly completely untested Gem::Package::TarInput and all its closely-coupled related classes in Gem::Package I gave up because it had already taken at three times longer to even think about writing the first line of a test than it took to find and fix.

You're welcome to succeed where I failed!

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