Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text() does not strip UTF-8 BOM from HTTP response #72

Open
rhargreaves opened this issue Mar 14, 2022 · 1 comment
Open

text() does not strip UTF-8 BOM from HTTP response #72

rhargreaves opened this issue Mar 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@rhargreaves
Copy link

Version: 0.2.4

We have an HTTP backend which adds a UTF-8 BOM to the start of HTTP responses. We noticed that it is present in the string returned by text(). It seems Node's own fetch() method have recently added a fix which strips out BOMs:

node-fetch/node-fetch#1482

Might be worth considering doing something similar? It doesn't feel right that text() returns a string which still contains a BOM. For now, we have made use of https://www.npmjs.com/package/strip-bom to remove the BOM from the string returned by text()

@JakeChampion
Copy link
Contributor

It looks like the change would be on this line:

The consume-body algorithm states that we need to run utf8-decode when the type given is text.

@JakeChampion JakeChampion added the bug Something isn't working label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants