Commit 0a3175f
[WebDriver][socket] Titles containing multibyte characters cannot be retrieved correctly
https://bugs.webkit.org/show_bug.cgi?id=270063
Reviewed by Alexey Proskuryakov.
If the document title contains multibyte characters such as Japanese
or entity references, the "Get Title" result will be garbled.
The title string is obtained by JavaScript's "document.title()",
and this data is encoded in UTF8.
However, the StringBuilder.append() function used to create HTTP messages
uses fromLatin1() internally to generate strings from byte data.
This seems to be causing the multibyte characters to be garbled.
This patch changes to use String::fromUTF8() before concatenation to
restore the correct WTF::String even if it contains multibyte characters.
Also, the change of get.py is regression test for this issue.
This is an export from web-platform-tests/wpt#46584.
* Source/WebDriver/socket/HTTPServerSocket.cpp:
(WebDriver::HTTPRequestHandler::packHTTPMessage const):
* WebDriverTests/imported/w3c/webdriver/tests/classic/get_title/get.py:
(test_strip_and_collapse):
(test_title_included_entity_references):
(test_title_included_multibyte_char):
Canonical link: https://commits.webkit.org/279767@main1 parent f5df91c commit 0a3175f
File tree
2 files changed
+16
-2
lines changed- Source/WebDriver/socket
- WebDriverTests/imported/w3c/webdriver/tests/classic/get_title
2 files changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments