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:
parent
3f9af8a9dc
commit
be68b3a490
Notes:
git
2022-01-08 00:50:28 +09:00
1 changed files with 1 additions and 0 deletions
1
string.c
1
string.c
|
@ -3189,6 +3189,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
|
||||||
if (RSTRING_LEN(str) == 0) {
|
if (RSTRING_LEN(str) == 0) {
|
||||||
rb_str_buf_cat(str, ptr, len);
|
rb_str_buf_cat(str, ptr, len);
|
||||||
ENCODING_CODERANGE_SET(str, ptr_encindex, ptr_cr);
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
goto incompatible;
|
goto incompatible;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue