From ec46a75ccabb2be32ace3236fc82380cf35b01cd Mon Sep 17 00:00:00 2001 From: Shogun Date: Wed, 6 Apr 2022 11:41:00 +0200 Subject: [PATCH 1/2] doc: add note about header values encoding --- doc/api/http.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/http.md b/doc/api/http.md index dd8c90d79a3404..9adcba7b17039d 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -987,6 +987,17 @@ or request.setHeader('Cookie', ['type=ninja', 'language=javascript']); ``` +When the value is a string an exception will be thrown if it contains +characters outside the `latin1` encoding. + +If you need to pass UTF-8 characters in the value please encode the value +using the [RFC 8187][] standard. + +```js +const filename = 'Rock 🎵.txt'; +request.setHeader('Content-Disposition', `inline; filename*=utf-8''${encodeURIComponent(filename)}`); +``` + ### `request.setNoDelay([noDelay])`