diff --git a/ChangeLog b/ChangeLog index 571bb7cfd0..bb29100a4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 4 04:42:05 2014 NARUSE, Yui + + * lib/net/htp/response.rb (Net::Inflater#inflate_adapter): + prevent automatic encoding conversion. + Fri Jul 4 04:39:52 2014 NARUSE, Yui * lib/net/http/response.rb (Net::HTTPResponse.each_response_header): diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index 33a7804cdc..45115295d9 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -369,6 +369,11 @@ class Net::HTTPResponse # entire body in memory. def inflate_adapter(dest) + if dest.respond_to?(:set_encoding) + dest.set_encoding(Encoding::ASCII_8BIT) + elsif dest.respond_to?(:force_encoding) + dest.force_encoding(Encoding::ASCII_8BIT) + end block = proc do |compressed_chunk| @inflate.inflate(compressed_chunk) do |chunk| dest << chunk