mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
AK: Do not append string bytes as code points when title-casing a string
By appending individual bytes as code points, we were "breaking apart" multi-byte UTF-8 code points. This now behaves the same way as the invert_case() helper in StringUtils.
This commit is contained in:
parent
66e424a084
commit
b9dc0b7d1b
2 changed files with 4 additions and 2 deletions
|
@ -465,9 +465,9 @@ String to_titlecase(StringView str)
|
|||
|
||||
for (auto ch : str) {
|
||||
if (next_is_upper)
|
||||
builder.append_code_point(to_ascii_uppercase(ch));
|
||||
builder.append(to_ascii_uppercase(ch));
|
||||
else
|
||||
builder.append_code_point(to_ascii_lowercase(ch));
|
||||
builder.append(to_ascii_lowercase(ch));
|
||||
next_is_upper = ch == ' ';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue