Remote: Preserve BOM in UTF-8 when found (fixes #48826)

This commit is contained in:
Benjamin Pasero
2019-04-16 16:49:33 +02:00
parent 7d8d01a61e
commit eacb2d85df
13 changed files with 150 additions and 58 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import * as iconv from 'iconv-lite';
import { isLinux, isMacintosh } from 'vs/base/common/platform';
import { exec } from 'child_process';
import { Readable, Writable } from 'stream';
import { VSBuffer } from 'vs/base/common/buffer';
export const UTF8 = 'utf8';
export const UTF8_with_bom = 'utf8bom';
@@ -160,7 +161,7 @@ function toNodeEncoding(enc: string | null): string {
return enc;
}
export function detectEncodingByBOMFromBuffer(buffer: Buffer | null, bytesRead: number): string | null {
export function detectEncodingByBOMFromBuffer(buffer: Buffer | VSBuffer | null, bytesRead: number): string | null {
if (!buffer || bytesRead < 2) {
return null;
}