diff --git a/doc/api/buffer.md b/doc/api/buffer.md index c94f03fa065a36..f033f8a20ae9dc 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -203,7 +203,20 @@ The character encodings currently supported by Node.js include: * `'binary'`: Alias for `'latin1'`. -* `'hex'`: Encode each byte as two hexadecimal characters. +* `'hex'`: Encode each byte as two hexadecimal characters. Data truncation + may occur for unsanitized input. For example: + +```js +Buffer.from('1ag', 'hex'); +// Prints , data truncated when first non-hexadecimal value +// ('g') encountered. + +Buffer.from('1a7g', 'hex'); +// Prints , data truncated when data ends in single digit ('7'). + +Buffer.from('1634', 'hex'); +// Prints , all data represented. +``` Modern Web browsers follow the [WHATWG Encoding Standard][] which aliases both `'latin1'` and `'ISO-8859-1'` to `'win-1252'`. This means that while doing