Skip to content

docs: Buffer.toString(): add note about invalid data

Rodrigo Muino Tomonari requested to merge github/fork/jgehrcke/patch-1 into master

New to the ecosystem. I looked up the docs to see how Buffer.toString() behaves upon invalid input data (for building solid code it's of course critically important to know whether it throws an error, or if it performs a surrogate escape instead). Is not documented as of today.

Once we modify the documentation we can close https://github.com/nodejs/node/issues/23280.

There is an existing patch: https://github.com/nodejs/node/pull/28249/ -- but it's probably too controversial as of the amount of information I think.

I tried to stay minimal here, so that we at least don't ignore the topic in the docs.

https://github.com/nodejs/node/issues/6075 is about the same topic, I think nobody questions that we need to have the behavior of toString() documented w.r.t. invalid byte sequences in the input.

Checklist

Merge request reports

Loading