aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/string.c b/string.c
index e93af5cece..728676c159 100644
--- a/string.c
+++ b/string.c
@@ -2460,6 +2460,18 @@ rb_str_append(VALUE str, VALUE str2)
return rb_str_buf_append(str, str2);
}
+VALUE
+rb_str_append_literal(VALUE str, VALUE str2)
+{
+ int encidx = rb_enc_get_index(str2);
+ rb_str_buf_append(str, str2);
+ if (encidx != ENCINDEX_US_ASCII) {
+ if (rb_enc_get_index(str) == ENCINDEX_US_ASCII)
+ rb_enc_associate_index(str, encidx);
+ }
+ return str;
+}
+
/*
* call-seq:
* str << integer -> str