Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0a3175f4f36add1cbc3e595fa45ce59081303f8c
      
https://github.com/WebKit/WebKit/commit/0a3175f4f36add1cbc3e595fa45ce59081303f8c
  Author: Haruhisa SHIN <[email protected]>
  Date:   2024-06-06 (Thu, 06 Jun 2024)

  Changed paths:
    M Source/WebDriver/socket/HTTPServerSocket.cpp
    M WebDriverTests/imported/w3c/webdriver/tests/classic/get_title/get.py

  Log Message:
  -----------
  [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 https://github.com/web-platform-tests/wpt/pull/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@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to