From: nobu.nokada@... Date: 2002-09-17T02:05:05+09:00 Subject: Re: Windows port; can I disable auto "\n" -> "\r\n" conversion? Hi, At Mon, 16 Sep 2002 09:28:01 +0900, Mike Williams wrote: > I'm using with the Pragmatic port of ruby (1.7.2), which appears to be > automatically converting my line-endings to CRLF. For example: > > $ ruby -e 'print "abc\n"' | od -c > 0000000 a b c \r \n > 0000005 > > This is playing havoc with my source-code; running something like > > $ ruby -i~ -ple 'gsub(/XXXX/, "XXXX")' *.java > > results in all my files being converted from Unix-text to Windoze-text > format!! > > Is there some way I can disable the magic conversion of CR to CRLF? STDOUT.binmode. For oneliners, you can put following code into binmode.rb in your RUBYLIB or site_ruby directory, and use -rbinmode option. STDIN.binmode STDOUT.binmode STDERR.binmode Once I'd suggested -b command line option and IO.binmode accessor which control default open mode. -- Nobu Nakada