1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (rb_io_mode_enc): set default external encoding if no

encoding specified explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-12-21 03:29:54 +00:00
parent e613c7cf5f
commit 74a0c0cc7e
2 changed files with 10 additions and 2 deletions

View file

@ -10,6 +10,11 @@ Fri Dec 21 12:16:50 2007 Tanaka Akira <akr@fsij.org>
* string.c (rb_str_is_ascii_only_p): new method ascii_only?.
Fri Dec 21 12:11:57 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_mode_enc): set default external encoding if no
encoding specified explicitly.
Fri Dec 21 12:00:34 2007 Tanaka Akira <akr@fsij.org>
* configure.in: check langinfo.h and locale.h.

7
io.c
View file

@ -3068,6 +3068,9 @@ rb_io_mode_enc(rb_io_t *fptr, const char *mode)
}
#endif
}
else if (!(fptr->mode & FMODE_BINMODE)) {
fptr->enc = rb_default_external_encoding();
}
}
struct sysopen_struct {
@ -3188,8 +3191,8 @@ rb_file_open_internal(VALUE io, const char *fname, const char *mode)
rb_io_t *fptr;
MakeOpenFile(io, fptr);
rb_io_mode_enc(fptr, mode);
fptr->mode = rb_io_mode_flags(mode);
rb_io_mode_enc(fptr, mode);
fptr->path = strdup(fname);
fptr->fd = rb_sysopen(fptr->path, rb_io_mode_modenum(rb_io_flags_mode(fptr->mode)), 0666);
io_check_tty(fptr);
@ -3498,10 +3501,10 @@ pipe_open(const char *cmd, int argc, VALUE *argv, const char *mode)
port = io_alloc(rb_cIO);
MakeOpenFile(port, fptr);
rb_io_mode_enc(fptr, mode);
fptr->fd = fd;
fptr->stdio_file = fp;
fptr->mode = modef | FMODE_SYNC|FMODE_DUPLEX;
rb_io_mode_enc(fptr, mode);
fptr->pid = pid;
if (0 <= write_fd) {