1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Change termlen when changing encoding during concatenation

After changing the encoding, we should update the terminator length.
This commit is contained in:
Peter Zhu 2022-01-07 09:47:09 -05:00
parent 3f9af8a9dc
commit be68b3a490
Notes: git 2022-01-08 00:50:28 +09:00

View file

@ -3189,6 +3189,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
if (RSTRING_LEN(str) == 0) {
rb_str_buf_cat(str, ptr, len);
ENCODING_CODERANGE_SET(str, ptr_encindex, ptr_cr);
rb_str_change_terminator_length(str, rb_enc_mbminlen(str_enc), rb_enc_mbminlen(ptr_enc));
return str;
}
goto incompatible;