mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibTextCodec: Improve Latin-1 decoder so it decodes everything
I can now see Swedish letters when opening Google in the browser. :^)
This commit is contained in:
parent
35040dd2c4
commit
893a9ff5b0
Notes:
sideshowbarker
2024-07-19 06:04:02 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/893a9ff5b05
1 changed files with 6 additions and 1 deletions
|
@ -65,7 +65,12 @@ String Latin1Decoder::to_utf8(const StringView& input)
|
|||
StringBuilder builder(input.length());
|
||||
for (size_t i = 0; i < input.length(); ++i) {
|
||||
u8 ch = input[i];
|
||||
builder.append(ch >= 0x80 ? '?' : ch);
|
||||
if (ch & 0x80) {
|
||||
builder.append(0xc0 | (ch >> 6));
|
||||
builder.append(0x80 | (ch & 0x3f));
|
||||
} else {
|
||||
builder.append(ch);
|
||||
}
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue