From: James Gray Date: 2011-04-25T22:57:52+09:00 Subject: [ruby-core:35878] Re: [Ruby 1.9 - Bug #4603][Open] lib/csv.rb: when the :encoding parameter is not provided, the encoding of CSV data is treated as ASCII-8BIT --0022159761c6d5ad0a04a1be977b Content-Type: text/plain; charset=UTF-8 On Sun, Apr 24, 2011 at 11:29 PM, NARUSE, Yui 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 --0022159761c6d5ad0a04a1be977b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The issue is that a mode of "rb" is being used= to suppress newline translation on Windows. =C2=A0However, that's also= switching my Encoding to ASCII-8BIT. =C2=A0Usually I love that feature, bu= t here it's not what I want. =C2=A0Is there anyway to shut off the tran= slation and not get the encoding change?

James Edward Gray II

--0022159761c6d5ad0a04a1be977b--