diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-28 03:04:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-28 03:04:21 +0000 |
commit | 8d397604bf72d5efb525da5c3291f1197bcd3e9f (patch) | |
tree | 1651ef37b44bf97d327e71114c829221ea16be61 /string.c | |
parent | 0b99ce1fd6276b8a0dd900ac95ac39c625e5448e (diff) |
* string.c (str_new): sets empty string to coderange 7bit.
[ruby-core:18993]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -395,6 +395,9 @@ str_new(VALUE klass, const char *ptr, long len) RSTRING(str)->as.heap.ptr = ALLOC_N(char,len+1); STR_SET_NOEMBED(str); } + else if (len == 0) { + ENC_CODERANGE_SET(str, ENC_CODERANGE_7BIT); + } if (ptr) { memcpy(RSTRING_PTR(str), ptr, len); } |