You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading files using the text loader, the loader doesn't strip byte order marks from the beginning of the file. For HTML files, for instance, this can turn into awkward problems like having an HTML entity like  inserted into the DOM inadvertently. Example here:
I think this change makes sense (and is trivial, so no need for a PR) but I could see it breaking things with code that relies on this (or that works around it), so I'm going to wait until a breaking change release to do this.
Could possibly go with opt-in behavior, and then change the default behavior (or remove the configurability altogether) on the next breaking change release?
When loading files using the text loader, the loader doesn't strip byte order marks from the beginning of the file. For HTML files, for instance, this can turn into awkward problems like having an HTML entity like

inserted into the DOM inadvertently. Example here:https://esbuild.github.io/try/#YgAwLjI0LjAALS1idW5kbGUKLS1mb3JtYXQ9ZXNtCi0tb3V0ZmlsZT1vdXQuanMKLS1zb3VyY2VtYXAKLS1kcm9wLWxhYmVsczpERUJVRwotLW1pbmlmeS1pZGVudGlmaWVycwotLWxvYWRlcjouaHRtbD10ZXh0AGUAZW50cnkudHMAaW1wb3J0IGZpbGVUZXh0IGZyb20gIi4vZXhhbXBsZS5odG1sIjsKCmNvbnNvbGUubG9nKGZpbGVUZXh0KTsAAGV4YW1wbGUuaHRtbAD+u788ZGl2PmhlbGxvIHdvcmxkPC9kaXY+
Bear in mind the example shows the text content of the HTML file as:
![image](https://private-user-images.githubusercontent.com/1608756/374260185-5dc763fc-c114-4850-8410-68c45df4e0e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTA3NjksIm5iZiI6MTczOTY5MDQ2OSwicGF0aCI6Ii8xNjA4NzU2LzM3NDI2MDE4NS01ZGM3NjNmYy1jMTE0LTQ4NTAtODQxMC02OGM0NWRmNGUwZTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDcyMTA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmQ4Nzk3MDhlYjkyOTcxZDFhNTFlNmEzMjRkMzAxZTJlMmQ4ODg0ZTdhMjg1MGQ1YzEyZjRhNmZiMzI3NjE5MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ewwSU8sfQ4U9XowBVqFVp4olwaWEAqOXbGxGyS-FEBw)
Whereas loading an HTML file with a BOM at the beginning in any reasonable text editor won't show that leading BOM.
I can work around it by ensuring that no text loader-loaded files have BOMs, but it does seem reasonable for the text loader to strip a leading BOM.
The text was updated successfully, but these errors were encountered: