mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-14 20:03:29 +00:00
LibTextCodec: Simplify Latin1Decoder::to_utf8
No intended behavior change.
This commit is contained in:
parent
c9c7069f9e
commit
01522b8d71
|
@ -65,12 +65,8 @@ String Latin1Decoder::to_utf8(const StringView& input)
|
|||
StringBuilder builder(input.length());
|
||||
for (size_t i = 0; i < input.length(); ++i) {
|
||||
u8 ch = input[i];
|
||||
if (ch & 0x80) {
|
||||
builder.append(0xc0 | (ch >> 6));
|
||||
builder.append(0x80 | (ch & 0x3f));
|
||||
} else {
|
||||
builder.append(ch);
|
||||
}
|
||||
// Latin1 is the same as the first 256 Unicode codepoints, so no mapping is needed, just utf-8 encoding.
|
||||
builder.append_codepoint(ch);
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue