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

MIME type parsing, comments #33

Closed
annevk opened this issue Oct 5, 2017 · 4 comments
Closed

MIME type parsing, comments #33

annevk opened this issue Oct 5, 2017 · 4 comments

Comments

@annevk
Copy link
Member

@annevk annevk commented Oct 5, 2017

Both http://searchfox.org/mozilla-central/source/netwerk/base/nsURLHelper.cpp#836 and Chrome source code indicate that the ";(" sequence means something special in MIME types and it looks like parsing is supposed to stop there, due to some legacy MIME type comment feature.

However, when I try something like

HTTP/1.1 200
Content-Length: 55
Content-Type: text/html;test=test;(;charset=gbk

<script>document.write(document.characterSet)</script>

browsers consistently end up not ignoring the charset parameter, so I'm not sure what is going on.

@mcmanus @sleevi help appreciated.

@annevk
Copy link
Member Author

@annevk annevk commented Oct 5, 2017

Ah, ";(" just means to look for either and it only works for charset parameter values. With text/html;charset=gbk(test) I can reproduce and it seems only Chrome and Firefox implement this kind of parsing. Edge and Safari will output windows-1252 rather than GBK. So maybe it's time to remove this oddity.

With text/html;x=(;charset=gbk all browsers detect GBK.

@annevk
Copy link
Member Author

@annevk annevk commented Oct 6, 2017

For text/html(;charset=gbk Chrome, Edge, and Firefox detect GBK; Safari renders it as text. For text/html(charset=gbk Chrome and Firefox will detect windows-1252, Edge will download, and Safari renders it as text.

I think that still means we can remove this quirk and will file bugs accordingly.

@annevk
Copy link
Member Author

@annevk annevk commented Nov 24, 2017

Bugs filed and tested by #42, so closing.

@annevk annevk closed this Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.