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, parameter values #40

Closed
annevk opened this issue Oct 10, 2017 · 1 comment
Closed

MIME type parsing, parameter values #40

annevk opened this issue Oct 10, 2017 · 1 comment

Comments

@annevk
Copy link
Member

annevk commented Oct 10, 2017

This is probably worth discussing here, if not just to have a reference. Parameter values can be unquoted or quoted. When they're quoted they can contain a couple more characters, such as ";". Inside a quoted value you escape \ and ", by preceding them with a \. You can also escape other code points, but that's a no-op.

The data model I created effectively stores the values as given. "\g\b\k" does become "gbk", but "\"" stays "\"". gbk stays gbk. This means that you need an algorithm to extract the "raw value".

The reason I did this is because browsers currently mostly pass through MIME types, and don't normalize them to all have quoted (or unquoted) parameters. We could decide on something else, but it seems that would be a bigger change from the status quo.

cc @bzbarsky @sleevi @mcmanus

@annevk
Copy link
Member Author

annevk commented Nov 26, 2017

It's worth mentioning here that we'll need quoted values sometimes as you cannot represent ";" otherwise for instance. Given that, I think this data model is good enough. It just complicates a couple consumers in the platform a little as they have to invoke a "get the parameter value" algorithm to get the actual value to operate on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant