Skip to content

lib: ensure `TextDecoder` only removes `utf8` BOM on `utf8` encoding

While working on https://github.com/gulpjs/remove-bom-stream/pull/8, I noticed that our test case to ensure a UTF-8 BOM at the beginning of a UTF-16 file wouldn't be removed; however, it was.

I dug into the PR at https://github.com/nodejs/node/pull/30132 and noticed that it lost the utf-8 and utf-16-le checks in the refactor.

This should limit the BOM removal to just the UTF-8 encoding. There should also be a follow-up PR that adds the utf-16-le BOM removal back to the code.

Merge request reports

Loading