On Sun, Apr 24, 2011 at 11:29 PM, NARUSE, Yui <naruse / airemix.jp> wrote:

> Ah, sorry, that commit message doesn't explain the intention.
> It is for IO-like object which doesn't have encoding method, for
> example Zlib::GzipReader
> test_gzip_reader_bug_fix in test/csv/test_features.rb.
>
> Anyway, even if I applied following patch, the problem is still reproduced.
>
> diff --git a/lib/csv.rb b/lib/csv.rb
> index 45273f9..ee35ccc 100644
> --- a/lib/csv.rb
> +++ b/lib/csv.rb
> @@ -2296,7 +2296,7 @@ class CSV
>     elsif @io.respond_to? :encoding
>       @io.encoding
>     else
> -      default
> +      Encoding.default_internal || Encoding.default_external
>     end
>   end
>  end
>

OK, I see the problem.

The issue is that a mode of "rb" is being used to suppress newline
translation on Windows.  However, that's also switching my Encoding to
ASCII-8BIT.  Usually I love that feature, but here it's not what I want.  Is
there anyway to shut off the translation and not get the encoding change?

James Edward Gray II