diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-01 01:33:17 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-01 01:33:17 +0000 |
commit | 4c7d380a81644567142895b88e126ee12dd75d8f (patch) | |
tree | 0b3cd14c9a02b8599d2ffaa75bbb1df063439452 /io.c | |
parent | 840723e523cd54689b41bdc94abad6e63a991c6f (diff) | |
download | ruby-4c7d380a81644567142895b88e126ee12dd75d8f.tar.gz |
* io.c (read_all, rb_io_getline_fast): encoding is rb_input_encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1359,8 +1359,8 @@ read_all(rb_io_t *fptr, long siz, VALUE str) long bytes = 0; long n; long pos = 0; - rb_encoding *enc = io_read_encoding(fptr); - int cr = 0; + rb_encoding *enc = io_input_encoding(fptr); + int cr = fptr->enc2 ? ENC_CODERANGE_BROKEN : 0; if (siz == 0) siz = BUFSIZ; if (NIL_P(str)) { @@ -1802,8 +1802,8 @@ rb_io_getline_fast(rb_io_t *fptr) VALUE str = Qnil; int len = 0; long pos = 0; - rb_encoding *enc = io_read_encoding(fptr); - int cr = 0; + rb_encoding *enc = io_input_encoding(fptr); + int cr = fptr->enc2 ? ENC_CODERANGE_BROKEN : 0; for (;;) { long pending = READ_DATA_PENDING_COUNT(fptr); @@ -1839,7 +1839,7 @@ rb_io_getline_fast(rb_io_t *fptr) } str = io_enc_str(str, fptr); - ENC_CODERANGE_SET(str, cr); + if (!fptr->enc2) ENC_CODERANGE_SET(str, cr); fptr->lineno++; lineno = INT2FIX(fptr->lineno); return str; |