From dc08e762fc66c86e14d22ebd2a4253fe59ba39d0 Mon Sep 17 00:00:00 2001 From: tarui Date: Mon, 7 Nov 2011 16:33:51 +0000 Subject: * io.c (make_writeconv): unversal_newline converter is for reading. so, if the io is text mode and has ECONV_UNIVERSAL_NEWLINE_DECORATOR flag, use crlf_newline converter for writing. this change fixes the problem about the luck of CR up Kernel.p and Kernel.puts to stdout/stderr on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index c8f941b065..d13ba93edd 100644 --- a/io.c +++ b/io.c @@ -754,8 +754,11 @@ make_writeconv(rb_io_t *fptr) ecopts = fptr->encs.ecopts; #ifdef TEXTMODE_NEWLINE_DECORATOR_ON_WRITE if (NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) && - !(ecflags & ECONV_NEWLINE_DECORATOR_MASK)) + (!(ecflags & ECONV_NEWLINE_DECORATOR_MASK) || + (ecflags & ECONV_UNIVERSAL_NEWLINE_DECORATOR))) { + ecflags &= ~ECONV_UNIVERSAL_NEWLINE_DECORATOR; ecflags |= TEXTMODE_NEWLINE_DECORATOR_ON_WRITE; + } #endif if (!fptr->encs.enc || (fptr->encs.enc == rb_ascii8bit_encoding() && !fptr->encs.enc2)) { -- cgit v1.2.3