From 28700093f62e3a79d17cc72355bd0187f91f0662 Mon Sep 17 00:00:00 2001 From: John Chen Date: Tue, 14 May 2019 13:47:47 -0700 Subject: [PATCH] Fix node.js handling of multi-byte UTF8 characters (#6761) * Fix node.js handling of multi-byte UTF8 characters Fixes issue #6280, where the node.js API doesn't properly handle multi-byte UTF8 characters received from the driver. * Specify encoding in toString --- javascript/node/selenium-webdriver/http/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/node/selenium-webdriver/http/index.js b/javascript/node/selenium-webdriver/http/index.js index 0539305284529..cb884b3b3db42 100644 --- a/javascript/node/selenium-webdriver/http/index.js +++ b/javascript/node/selenium-webdriver/http/index.js @@ -235,7 +235,7 @@ function sendRequest(options, onOk, onError, opt_data, opt_proxy, opt_retries) { var resp = new httpLib.Response( /** @type {number} */(response.statusCode), /** @type {!Object} */(response.headers), - body.join('').replace(/\0/g, '')); + Buffer.concat(body).toString('utf8').replace(/\0/g, '')); onOk(resp); }); });