Merge pull request #19991 from Microsoft/fix-bom

Use UTF8 BOM in emit
This commit is contained in:
Ron Buckton 2017-11-13 16:38:22 -08:00 committed by GitHub
commit 26ef7e5533
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = "\uFEFF" + 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 = "\uFEFF" + data;
data = utf8ByteOrderMark + data;
}
ChakraHost.writeFile(path, data);