diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-21 03:29:54 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-21 03:29:54 +0000 |
| commit | 931feba48be6f5079b6cdcd8cef869f83b9f0253 (patch) | |
| tree | e591fa4926c871997984f388be05a765bebb534e /io.c | |
| parent | f02b06802767fd77e1c2bc546b217dedb71efb91 (diff) | |
| download | ruby-931feba48be6f5079b6cdcd8cef869f83b9f0253.tar.gz ruby-931feba48be6f5079b6cdcd8cef869f83b9f0253.tar.xz ruby-931feba48be6f5079b6cdcd8cef869f83b9f0253.zip | |
* io.c (rb_io_mode_enc): set default external encoding if no
encoding specified explicitly.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
| -rw-r--r-- | io.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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) { |
