From: Brian Candler Date: 2010-06-25T16:57:10+09:00 Subject: Re: marshalled data in 1.9 Roger Pack wrote: > >>> But I had assumed since I was reading and writing in the same mode it >>> would work all right. Was I wrong? >>> -r >> >> You almost certainly want the 'rb' and 'wb' modes on Windows to read >> and write in binary, rather than text, mode. > > Hmm. The problem may occur when I read the file in--because I'm not > reading it in Binary mode, I'm actually reading it in as ascii + some > encoding (Encoding.default_external), which is IBM437 > > I'm still not entirely sure why something like this *shouldn't* round > trip appropriately though. If you're under Windows, ruby/C will translate \r\n to \n on read and vice versa on write, unless you open the file in binary mode. -- Posted via http://www.ruby-forum.com/.