Skip to content

Commit 3cc2e04

Browse files
committed
utils: ensure TextDecoder is only removing utf-8 BOM on utf-8 encoding
1 parent bde889b commit 3cc2e04

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/internal/encoding.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ function makeTextDecoderJS() {
512512
this[kHandle].write(input);
513513

514514
if (result.length > 0 &&
515+
this[kEncoding] === 'utf-8' &&
515516
!this[kBOMSeen] &&
516517
!(this[kFlags] & CONVERTER_FLAGS_IGNORE_BOM)) {
517518
// If the very first result in the stream is a BOM, and we are not

0 commit comments

Comments
 (0)