`URLSearchParams` doesn’t perform UTF-8 decoding unlike Gecko’s implementation |
|||||
Issue description
What steps will reproduce the problem?
new URLSearchParams('foo=%EF%BF%BF').get('foo')
What is the expected output?
In Firefox, the result is:
'\uFFFF'
What do you see instead?
In Chromium, the result is:
'\xEF\xBF\xBF'
This is a compatibility issue.
,
Aug 1 2016
,
Aug 1 2016
Are there web platform tests for this behavior? Or does Blink simply not run them?
,
Aug 1 2016
decodeURLEscapeSequences() doesn't perform UTF-8 decoding as specified in https://url.spec.whatwg.org/#concept-urlencoded-parser
,
Aug 1 2016
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1290848
,
Aug 1 2016
> decodeURLEscapeSequences() doesn't perform UTF-8 decoding as specified in https://url.spec.whatwg.org/#concept-urlencoded-parser AFAICT it does — see step 1 and step 8. Also note that for `new URLSearchParams(str)`, https://url.spec.whatwg.org/#concept-urlencoded-string-parser is used instead, which UTF-8-encodes first. (Search for “To create a new URLSearchParams object” in the spec.)
,
Aug 2 2016
> Comment 6 Sorry. I meant that decodeURLEscapeSequences() isn't doing what's required in the spec, and that's what we should fix, in comment 4.
,
Aug 2 2016
I thought I changed the status to Available in comment 4 but I failed to.
,
Aug 24 2016
I was wrong. decodeURLEscapeSequences() does decoding but leaves high/low surrogates and Unicode noncharacter code points not decoded. url::ReadUTFChar() does that which is used by url::DecodeURLEscapeSequences() used by blink::decodeURLEscapeSequences(). Need to add option or create a new variant that uses base::ConvertUnicode() instead.
,
Jan 11 2017
https://github.com/w3c/web-platform-tests/pull/4517 has some tests for this as well which Chrome fails (also has some Firefox failures).
,
Mar 9 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 12 2018
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by tyoshino@chromium.org
, Aug 1 2016