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

Decode without BOM #85

Closed
annevk opened this issue Dec 18, 2016 · 3 comments
Closed

Decode without BOM #85

annevk opened this issue Dec 18, 2016 · 3 comments

Comments

@annevk
Copy link
Member

annevk commented Dec 18, 2016

For whatwg/url#84 I need a new specification hook of sorts. This is similar to what is already exposed through TextDecoder with ignoreBOM.

(I should probably create some tests around this first though.)

@annevk
Copy link
Member Author

annevk commented Dec 20, 2016

The obvious solution here would be to add an "ignore BOM flag" to the algorithm, but since whatwg/html#1077 (comment) potentially requires revamping things anyway, perhaps both should be tackled at once, to minimize the number of changes.

@hsivonen
Copy link
Member

hsivonen commented Jan 4, 2017

The present spec concepts, when generalized to apply to all encodings (currently some only apply to UTF-8) result is:

  • Decode (with BOM sniffing)
  • Decode with BOM removal (remove the BOM if it's for this encoding but treat BOMs for other encodings as garbage)
  • Decode without BOM handling (don't look at the BOM, treat it as garbage)

encoding_rs already supports these generalizations. The mapping onto these from the current spec concepts is documented.

@annevk
Copy link
Member Author

annevk commented Jan 6, 2017

So the problem is that https://url.spec.whatwg.org/#urlencoded-parsing is only for servers. Browsers only ever use it with UTF-8 (in Fetch and in the URL API). So I think the solution here is to not change Encoding, but rather change URL to only support UTF-8 and let servers modify the algorithm if they need more than UTF-8.

@annevk annevk closed this as completed Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants