buffer icon indicating copy to clipboard operation
buffer copied to clipboard

Incorrect toString for invalid UTF8 multibyte codepoints

Open mischnic opened this issue 4 years ago • 0 comments

For example Buffer.from(Buffer.from([0xE0, 0xAC]).toString()) produces <Buffer ef bf bd> with the native Node Buffer while this package currently outputs <Buffer ef bf bd ef bf bd>. So it somehow tries to match multiple bytes even if some of them are missing and doesn't emit a replacement character for every single byte.

This only adds failing tests because I'm not sure how this should be fixed

mischnic avatar Dec 08 '21 11:12 mischnic