stream: convert existing buffer when calling .setEncoding
Convert already-stored chunks when .setEncoding()
is called
so that subsequent data
events will receive decoded strings,
as they expect.
Fixes: https://github.com/nodejs/node/issues/27932
@nodejs/streams
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines