We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0154a5a commit 1f17b54Copy full SHA for 1f17b54
ext/mbstring/libmbfl/filters/mbfilter_hz.c
@@ -372,7 +372,7 @@ static void mb_wchar_to_hz(uint32_t *in, size_t len, mb_convert_buf *buf, bool e
372
} else if (s < 0x80) {
373
/* ASCII */
374
if (buf->state != ASCII) {
375
- MB_CONVERT_BUF_ENSURE(buf, out, limit, len + 2);
+ MB_CONVERT_BUF_ENSURE(buf, out, limit, len + 3);
376
out = mb_convert_buf_add2(out, '~', '}');
377
buf->state = ASCII;
378
}
@@ -385,11 +385,12 @@ static void mb_wchar_to_hz(uint32_t *in, size_t len, mb_convert_buf *buf, bool e
385
} else {
386
/* GB 2312-80 */
387
if (buf->state != GB2312) {
388
+ MB_CONVERT_BUF_ENSURE(buf, out, limit, len + 4);
389
out = mb_convert_buf_add2(out, '~', '{');
390
buf->state = GB2312;
391
+ } else {
392
+ MB_CONVERT_BUF_ENSURE(buf, out, limit, len + 2);
393
394
out = mb_convert_buf_add2(out, (s >> 8) & 0x7F, s & 0x7F);
395
396
0 commit comments