From ab7304767e257c20164f558fc0a294c72670e89c Mon Sep 17 00:00:00 2001 From: Jan-Philip Gehrcke Date: Thu, 28 Nov 2019 19:30:52 +0100 Subject: [PATCH] doc: Buffer.toString(): add note about invalid data PR-URL: https://github.com/nodejs/node/pull/30706 Reviewed-By: Anna Henningsen Reviewed-By: Denys Otrishko Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: David Carlier --- doc/api/buffer.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index e614851bb5250e..c94f03fa065a36 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -2162,6 +2162,8 @@ added: v0.1.90 Decodes `buf` to a string according to the specified character encoding in `encoding`. `start` and `end` may be passed to decode only a subset of `buf`. +If a byte sequence in the input is not valid in the given `encoding` then +it is replaced with the replacement character `U+FFFD`. The maximum length of a string instance (in UTF-16 code units) is available as [`buffer.constants.MAX_STRING_LENGTH`][].