Encoding of non-ASCII characters in response bodies is broken
Categories
(Remote Protocol :: WebDriver BiDi, defect, P3)
Tracking
(firefox145 fixed)
| Tracking | Status | |
|---|---|---|
| firefox145 | --- | fixed |
People
(Reporter: hbenl, Assigned: jdescottes)
References
Details
(Whiteboard: [webdriver:m17][webdriver:relnote])
Attachments
(2 files)
This Playwright test fails when I try it with this PR and when I look at the raw BiDi messages I see that the character Ü is represented by the bytes C3 83 C2 9C. This looks like a double encoding (in node.js Buffer.from(Buffer.from("Ü", "utf8").toString("latin1"), "utf8") gives me <Buffer c3 83 c2 9c>).
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
Had a quick look, it seems we actually don't get the charset for the response, and we fail to decode the stream properly.
The channel's contentCharset is not set for this response. It seems in most spots DevTools falls back to UTF-8 when the charset is not set, so maybe we should do the same here.
| Assignee | ||
Comment 2•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Comment 3•2 months ago
|
||
This can be entirely fixed in devtools, but I'll try to add a wdspec test for it anyway.
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 4•2 months ago
|
||
I wrote a wdspec test, but I actually see that Chrome has the same behavior as current Firefox so we might need a spec discussion about what to do for responses which don't define a charset.
Here maybe you could propose a PR to fix the test with
server.setRoute('/empty.html', (req, res) => {
res.statusCode = 200;
res.setHeader('content-type', 'text/plain; charset=utf-8');
res.end(Buffer.from('Ü (lowercase ü)', 'utf-8'));
});
?
| Assignee | ||
Comment 5•2 months ago
|
||
In the meantime I filed https://github.com/w3c/webdriver-bidi/issues/1005
The wdspec test is up at https://github.com/web-platform-tests/wpt/pull/54928 for discussion.
I will remove the patches from the review queue until we have an agreement.
| Assignee | ||
Comment 6•2 months ago
|
||
| Reporter | ||
Comment 7•2 months ago
|
||
Here maybe you could propose a PR to fix the test
I'd prefer to keep the test failing since it shows a real issue.
| Assignee | ||
Updated•2 months ago
|
Comment 9•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/e447db312c3a
https://hg.mozilla.org/mozilla-central/rev/da770b22c2f1
Updated•1 month ago
|
Description
•