diff --git a/ChangeLog b/ChangeLog index bbb2a8a3ef..2997714fb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Apr 28 06:06:56 2011 Nobuyoshi Nakada + + * io.c (rb_io_extract_modeenc, rb_f_backquote): set default text + mode. fixes #4619 + + * io.c (pipe_open): set universal newline decorator if needed. + Wed Apr 27 11:33:08 2011 NARUSE, Yui * enc/trans/emoji_iso2022_kddi.trans: ISO-2022-JP-KDDI doesn't have diff --git a/io.c b/io.c index 73a30cd305..328abc7ea8 100644 --- a/io.c +++ b/io.c @@ -4496,7 +4496,7 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2); if (NIL_P(vmode)) { - fmode = FMODE_READABLE; + fmode = FMODE_READABLE | DEFAULT_TEXTMODE; oflags = O_RDONLY; } else if (!NIL_P(intmode = rb_check_to_integer(vmode, "to_int"))) { @@ -5249,6 +5249,9 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode, if (convconfig) { fptr->encs = *convconfig; } + else if (NEED_NEWLINE_DECORATOR_ON_READ(fptr)) { + fptr->encs.ecflags |= ECONV_UNIVERSAL_NEWLINE_DECORATOR; + } fptr->pid = pid; if (0 <= write_fd) { @@ -7248,7 +7251,7 @@ rb_f_backquote(VALUE obj, VALUE str) rb_io_t *fptr; SafeStringValue(str); - port = pipe_open_s(str, "r", FMODE_READABLE, NULL); + port = pipe_open_s(str, "r", FMODE_READABLE|DEFAULT_TEXTMODE, NULL); if (NIL_P(port)) return rb_str_new(0,0); GetOpenFile(port, fptr);