-
Notifications
You must be signed in to change notification settings - Fork 44
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
http.DetectContentType do not return gbk charset by the mimesniff spec. #77
Comments
I have already raise an issue golang/go#27461 |
Unfortunately, detecting encodings is a non-goal for this algorithm. @agnivade if similar requests arrive on the golang side it's probably best not to redirect them here. We might still get limited encoding sniffing on the web platform standardized at some point (see whatwg/encoding#68 and whatwg/encoding#102), but that would only be used in a couple of places, sometime after MIME sniffing has done its thing. |
Ok, since we implement the mimesniff spec, we redirect any requests here. Where should we redirect them ? |
@agnivade basically we don't really want to extend this algorithm, so I suppose it'd be best to politely decline. The one exception is if someone found an interoperability issue between golang and a browser or an actual bug of some kind. |
this is my code:
and this is the output:
As you see, it should be decoded with
gbk
, but thehttp.DetectContentType
which using mimesniff lib returnutf-8
.Sadly I counld not found any chardet as powerful as python chardet or js chardet
So I have to wrapper the
http.DetectContentType
with a ugly way.This code can work, but should be with bugs.
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: