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?
cheers, Mike
Hi,
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.
···
At Mon, 16 Sep 2002 09:28:01 +0900, Mike Williams wrote:
–
Nobu Nakada
Is there some way I can disable the magic conversion of CR to CRLF?
STDOUT.binmode.
This is just what I was looking for, thanks.
Once I’d suggested -b command line option and IO.binmode
accessor which control default open mode.
I agree, a command-line switch would be useful.
···
nobu.nokada@softhome.net wrote: