fix(#773): use utf8 encoding when reading file when encoding not specified by options
This commit is contained in:
parent
51afeeaf54
commit
7b1c3e85ce
|
@ -1873,7 +1873,7 @@ function writeFile(context, path, data, options, callback) {
|
||||||
if(typeof data === 'number') {
|
if(typeof data === 'number') {
|
||||||
data = '' + data;
|
data = '' + data;
|
||||||
}
|
}
|
||||||
if(typeof data === 'string' && options.encoding === 'utf8') {
|
if(typeof data === 'string' && (options.encoding || 'utf8') === 'utf8') {
|
||||||
data = Buffer.from(data);
|
data = Buffer.from(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue