webrecorder / wabac.js

wabac.js - Web Archive Browsing Augmentation Client
https://replayweb.page
GNU Affero General Public License v3.0
96 stars 17 forks source link

Rewriting: Fix encoding when BOM is detected. #178

Closed ikreymer closed 1 month ago

ikreymer commented 1 month ago

If a UTF-8/UTF16-LE/UTF16-BE BOM is detected, ensure the text is then re-encoded as UTF-8 (without BOM markers) and a charset='utf-8' is added to the content-type header (if not there).

Otherwise, the rewritten response may be parsed incorrectly by the browser. Example: https://www.ledevoir.com/css/nweb/main.css?20240529