mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-05 05:50:31 +00:00
e01f1c949f
The previous behavior was to always VERIFY that the UTF-8 bytes were valid when iterating over the code points of an UTF8View. This change makes it so we instead output the 0xFFFD 'REPLACEMENT CHARACTER' code point when encountering invalid bytes, and keep iterating the view after skipping one byte. Leaving the decision to the consumer would break symmetry with the UTF32View API, which would in turn require heavy refactoring and/or code duplication in generic code such as the one found in Gfx::Painter and the Shell. To make it easier for the consumers to detect the original bytes, we provide a new method on the iterator that returns a Span over the data that has been decoded. This method is immediately used in the TextNode::compute_text_for_rendering method, which previously did this in a ad-hoc waay. This also add tests for the new behavior in TestUtf8.cpp, as well as reinforcements to the existing tests to check if the underlying bytes match up with their expected values. |
||
---|---|---|
.. | ||
AK | ||
Kernel | ||
LibC | ||
LibCompress | ||
LibCore | ||
LibCpp | ||
LibELF | ||
LibGfx | ||
LibJS | ||
LibM | ||
LibPthread | ||
LibRegex | ||
LibSQL | ||
LibWasm | ||
LibWeb | ||
UserspaceEmulator | ||
CMakeLists.txt |