add BOM skip logic

This commit is contained in:
Ken Aoki
2021-01-23 11:42:16 +00:00
parent 93aab95f7b
commit 3d941f2fdf
2 changed files with 15 additions and 2 deletions
+2 -2
View File
@@ -192,8 +192,8 @@ export class Utf8ToUtf32 {
target[size++] = cp;
}
} else if (type === 3) {
if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF)) {
// illegal codepoint
if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {
// illegal codepoint or BOM
} else {
target[size++] = cp;
}