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

Content-Type charset=UTF-8 missing for text/html #106

Closed
rafrafek opened this issue Apr 23, 2021 · 2 comments · Fixed by #122
Closed

Content-Type charset=UTF-8 missing for text/html #106

rafrafek opened this issue Apr 23, 2021 · 2 comments · Fixed by #122

Comments

@rafrafek
Copy link

I'm running Svelte app with sirv public --single --no-clear and when I go to e.g. http://localhost:5000/foo/ it is served with header:
Content-Type: text/html
It should be:
Content-Type: text/html; charset=UTF-8

Without charset=UTF-8 in Content-Type header my web browser (Firefox) shows error in console that charset was not set.

I have set <meta charset="utf-8"> in <head> of my index.html file which is served by Sirv, but it doesn't help.

@kotx
Copy link

kotx commented Jun 19, 2021

I have this issue too, and Chromium logs it in the issues panel. However it's for all resources, not just for text/html.

@aleclarson
Copy link
Contributor

+1 This interferes with hydration of a React app

aleclarson added a commit to aleclarson/sirv that referenced this issue Oct 15, 2021
Closes lukeed#106

I considered fixing this upstream in "mime" or "mime-db" packages,
but then I came across these issues, which indicated that it was
not a viable path.

broofa/mime#174
jshttp/mime-db#94
lukeed added a commit that referenced this issue Oct 15, 2021
* fix: append charset=utf-8 to text/html

Closes #106

I considered fixing this upstream in "mime" or "mime-db" packages,
but then I came across these issues, which indicated that it was
not a viable path.

broofa/mime#174
jshttp/mime-db#94

* test: check for charset=utf-8 in .html requests

* fix(test): prevent undefined `full` access

* chore: add `charset=utf-8` to test expectants

* chore: light code style/spacing

Co-authored-by: Luke Edwards <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants