diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-22 02:18:23 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-22 02:18:23 +0000 |
| commit | 316b30d0d9071a9895cb246015da07e1ec12132b (patch) | |
| tree | 7b3c8e7252c1b945be711a1e64dd17285bb63fbd /string.c | |
| parent | 4db96d5f784a95a549db3b728de7a67eb3135cce (diff) | |
| download | ruby-316b30d0d9071a9895cb246015da07e1ec12132b.tar.gz ruby-316b30d0d9071a9895cb246015da07e1ec12132b.tar.xz ruby-316b30d0d9071a9895cb246015da07e1ec12132b.zip | |
* string.c (rb_str_substr): copy encoding although empty string.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1242,7 +1242,10 @@ rb_str_substr(VALUE str, long beg, long len) else { str2 = rb_str_new5(str, p, len); if (len) rb_enc_cr_str_copy(str2, str); - else ENC_CODERANGE_SET(str2, ENC_CODERANGE_7BIT); + else { + rb_enc_copy(str2, str); + ENC_CODERANGE_SET(str2, ENC_CODERANGE_7BIT); + } OBJ_INFECT(str2, str); } |
