summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-28 03:04:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-28 03:04:21 +0000
commit8d397604bf72d5efb525da5c3291f1197bcd3e9f (patch)
tree1651ef37b44bf97d327e71114c829221ea16be61 /string.c
parent0b99ce1fd6276b8a0dd900ac95ac39c625e5448e (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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string.c b/string.c
index 990694f24f..7d6f30555a 100644
--- a/string.c
+++ b/string.c
@@ -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);
}