diff --git a/src/node_shell_read.js b/src/node_shell_read.js index 6a1c07872a546..ab4464fc6d136 100644 --- a/src/node_shell_read.js +++ b/src/node_shell_read.js @@ -2,16 +2,14 @@ var ret; #if SUPPORT_BASE64_EMBEDDING ret = tryParseAsDataURI(filename); - if (!ret) { -#endif - if (!nodeFS) nodeFS = require('fs'); - if (!nodePath) nodePath = require('path'); - filename = nodePath['normalize'](filename); - ret = nodeFS['readFileSync'](filename); -#if SUPPORT_BASE64_EMBEDDING + if (ret) { + return binary ? ret : ret.toString(); } #endif - return binary ? ret : ret.toString(); + if (!nodeFS) nodeFS = require('fs'); + if (!nodePath) nodePath = require('path'); + filename = nodePath['normalize'](filename); + return nodeFS['readFileSync'](filename, binary ? null : 'utf8'); }; readBinary = function readBinary(filename) { diff --git a/src/worker.js b/src/worker.js index 48f6f0a55437a..13aba844d5a3d 100644 --- a/src/worker.js +++ b/src/worker.js @@ -290,7 +290,7 @@ if (typeof process === 'object' && typeof process.versions === 'object' && typeo var nodeFS = require('fs'); var nodeRead = function(filename) { - return nodeFS.readFileSync(filename).toString(); + return nodeFS.readFileSync(filename, 'utf8'); }; function globalEval(x) {