diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index a6e5cd7a392..aa928cdaacd 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -125,6 +125,8 @@ namespace ts { }; export let sys: System = (() => { + const utf8ByteOrderMark = "\u00EF\u00BB\u00BF"; + function getNodeSystem(): System { const _fs = require("fs"); const _path = require("path"); @@ -348,7 +350,7 @@ namespace ts { function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void { // If a BOM is required, emit one if (writeByteOrderMark) { - data = "\u00EF\u00BB\u00BF" + data; + data = utf8ByteOrderMark + data; } let fd: number; @@ -549,7 +551,7 @@ namespace ts { writeFile(path: string, data: string, writeByteOrderMark?: boolean) { // If a BOM is required, emit one if (writeByteOrderMark) { - data = "\u00EF\u00BB\u00BF" + data; + data = utf8ByteOrderMark + data; } ChakraHost.writeFile(path, data);