summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index c9110e8516..bee5fb100b 100644
--- a/string.c
+++ b/string.c
@@ -1884,7 +1884,10 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
}
else if (str_cr == ENC_CODERANGE_VALID) {
res_encindex = str_encindex;
- res_cr = str_cr;
+ if (ptr_cr == ENC_CODERANGE_7BIT || ptr_cr == ENC_CODERANGE_VALID)
+ res_cr = str_cr;
+ else
+ res_cr = ptr_cr;
}
else { /* str_cr == ENC_CODERANGE_BROKEN */
res_encindex = str_encindex;