summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTextCodec
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-03-27 08:48:25 +0200
committerAndreas Kling <kling@serenityos.org>2022-03-29 01:01:32 +0200
commitb006a60366c513528d0f7fe818be2558150e9b11 (patch)
tree228ab1a34254e5fc3cff7ff5670edf582c86721c /Userland/Libraries/LibTextCodec
parent7e4793df6351f14dcb3eba0172188fb966be760f (diff)
downloadserenity-b006a60366c513528d0f7fe818be2558150e9b11.zip
LibTextCodec: Pass code points instead of bytes on UTF-8 string process
Previously we were passing raw UTF-8 bytes as code points, which caused CSS content properties to display incorrect characters. This makes bullet separators in Wikipedia templates display correctly.
Diffstat (limited to 'Userland/Libraries/LibTextCodec')
-rw-r--r--Userland/Libraries/LibTextCodec/Decoder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibTextCodec/Decoder.cpp b/Userland/Libraries/LibTextCodec/Decoder.cpp
index 71795a265e..57695ec847 100644
--- a/Userland/Libraries/LibTextCodec/Decoder.cpp
+++ b/Userland/Libraries/LibTextCodec/Decoder.cpp
@@ -7,6 +7,7 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
+#include <AK/Utf8View.h>
#include <LibTextCodec/Decoder.h>
namespace TextCodec {
@@ -215,7 +216,7 @@ String Decoder::to_utf8(StringView input)
void UTF8Decoder::process(StringView input, Function<void(u32)> on_code_point)
{
- for (auto c : input) {
+ for (auto c : Utf8View(input)) {
on_code_point(c);
}
}