Set encoding before concatenating to string
If we set encoding after the call to rb_str_buf_cat, then rb_str_buf_cat will not set the correct terminator length.
This commit is contained in:
parent
ee4784c06e
commit
44368b5f8b
Notes:
git
2022-01-07 04:34:00 +09:00
2
string.c
2
string.c
@ -3186,8 +3186,8 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return str;
|
return str;
|
||||||
if (RSTRING_LEN(str) == 0) {
|
if (RSTRING_LEN(str) == 0) {
|
||||||
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_buf_cat(str, ptr, len);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
goto incompatible;
|
goto incompatible;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user