From 7b1c3e85cef98245604ab60841d681329286f4fb Mon Sep 17 00:00:00 2001 From: Ben Heidemann Date: Sun, 18 Apr 2021 13:27:32 +0100 Subject: [PATCH] fix(#773): use utf8 encoding when reading file when encoding not specified by options --- src/filesystem/implementation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filesystem/implementation.js b/src/filesystem/implementation.js index 3027688..90fbd22 100644 --- a/src/filesystem/implementation.js +++ b/src/filesystem/implementation.js @@ -1873,7 +1873,7 @@ function writeFile(context, path, data, options, callback) { if(typeof data === 'number') { data = '' + data; } - if(typeof data === 'string' && options.encoding === 'utf8') { + if(typeof data === 'string' && (options.encoding || 'utf8') === 'utf8') { data = Buffer.from(data); }