-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Can I specify the response charset? #296
Comments
@VincentWang1009 |
I'd like this feature, too. Can we have a proper release? @indexzero |
Just traced back a fairly subtle bug to the incorrect addition of +1 for a way to customize charset, but I believe the utf-8 charset should not be applied to images by default this way either. Demo:
My demo takes a very roundabout way of rendering the image ... normal |
Also note that because of this bug, loading an image via fetch() API (e.g. for use with createImageBitmap) will fail in Firefox. https://bugzilla.mozilla.org/show_bug.cgi?id=1413806. In fairness to Firefox, it's arguably doing the right thing. Any suggestions on this, or on what sort of PR would be accepted? If not a way to specify response charset, could we not default to utf8 for images? |
This line in It sets Relatedly, the mime package which node-ecstatic uses has a new major point release (2.0) and removes the charset detection altogether preferring a single Simple solution would be to change the default behavior of Either way, I'm afraid it's an upstream bug...though I'm on my way to make this request there, and would appreciate a 👍. 😄 |
Related issue at |
@donmccurdy here's the upstream PR if you'd like to test and 👍 it: |
@BigBlueHat thank you! 😃 It's likely to be a few days before I can test this but the changes look good. Code to reproduce the issue is included above (#296 (comment)) if someone else has the chance before I do. |
Confirmed that the change (jfhbrook/node-ecstatic#223) fixes the issue and Firefox can load the image correctly. 🎊 |
@donmccurdy thanks for that confirmation! It looks like we're all waiting on getting the That upstream situation is the same as our downstream one--i.e. I'm not keen to stop supporting the I just filed an issue to bring back ye olde There's also similar code available in an alternative mime-database-in-JSON module: Those aren't currently exposed as modules, though, they're just used to generate the JSON file. ...data formats are the death of computing... If anyone here feels like saving the day, we'd just need a module to convert Sorry it's not an easy fix... |
hi, I find the file http-server serve is returned with content-type 'charset=utf-8', can I config to return with other charset i.e 'charset=gbk' ?
The text was updated successfully, but these errors were encountered: