Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0040347ec43184bf8e4c452b1ee3b9c03d167301
      
https://github.com/WebKit/WebKit/commit/0040347ec43184bf8e4c452b1ee3b9c03d167301
  Author: Sihui Liu <[email protected]>
  Date:   2024-07-15 (Mon, 15 Jul 2024)

  Changed paths:
    M Source/WebCore/editing/MarkupAccumulator.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm

  Log Message:
  -----------
  Saved web page uses utf8 encoding but declared as non-utf8
https://bugs.webkit.org/show_bug.cgi?id=276615
rdar://131759536

Reviewed by Ryosuke Niwa.

When serializing DOM for saving to disk, the meta charset attribute that is 
used to declare encoding will be preserved,
but the file encoding is actually UTF-8. When loading the saved file in 
browser, the browser will use the declared
encoding but not the file encoding, so there could be decoding error. As a 
workaround, adding a new meta tag in the head
element to override the declared enocding.

API Test: WebArchive.SaveResourcesWithUTF8Encoding

* Source/WebCore/editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::startAppendingNode):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:
(TestWebKitAPI::(WebArchive, SaveResourcesBasic)):
(TestWebKitAPI::(WebArchive, SaveResourcesWithUTF8Encoding)):

Canonical link: https://commits.webkit.org/280993@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