diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-05 01:24:57 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-05 01:24:57 +0000 |
| commit | 8ec9fc106ce6d45deffc2a20093b7870e406dbf4 (patch) | |
| tree | b4224e2cd2533fda68f8a4b4acc8fea47b76e868 /string.c | |
| parent | 25f61288511fcd3dca5ef80fbf6b6cead5ec7856 (diff) | |
| download | ruby-8ec9fc106ce6d45deffc2a20093b7870e406dbf4.tar.gz ruby-8ec9fc106ce6d45deffc2a20093b7870e406dbf4.tar.xz ruby-8ec9fc106ce6d45deffc2a20093b7870e406dbf4.zip | |
* string.c (rb_str_chomp_bang): keeps 7bit coderange.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -6056,7 +6056,10 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str) memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) { if (rb_enc_left_char_head(p, pp, e, enc) != pp) return Qnil; - rb_str_modify(str); + str_modify_keep_cr(str); + if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) { + ENC_CODERANGE_CLEAR(str); + } STR_SET_LEN(str, RSTRING_LEN(str) - rslen); RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0'; return str; |
