mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 09:22:53 +00:00
LibTextCodec: Implement big5
encoder
Implements the `big5` encoder, as specified by https://encoding.spec.whatwg.org/#big5-encoder
This commit is contained in:
parent
826292536c
commit
34c8c559c1
Notes:
github-actions[bot]
2024-08-08 16:51:24 +00:00
Author: https://github.com/BenJilks
Commit: 34c8c559c1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/975
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/skyrising
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 92 additions and 0 deletions
|
@ -61,3 +61,21 @@ TEST_CASE(test_euc_kr_encoder)
|
|||
EXPECT(processed_bytes[2] == 0xF0);
|
||||
EXPECT(processed_bytes[3] == 0xD8);
|
||||
}
|
||||
|
||||
TEST_CASE(test_big5_encoder)
|
||||
{
|
||||
TextCodec::Big5Encoder encoder;
|
||||
// U+A7 Section Sign
|
||||
// U+70D7 CJK Unified Ideograph-70D7
|
||||
auto test_string = "\U000000A7\U000070D7"sv;
|
||||
|
||||
Vector<u8> processed_bytes;
|
||||
MUST(encoder.process(Utf8View(test_string), [&](u8 byte) {
|
||||
return processed_bytes.try_append(byte);
|
||||
}));
|
||||
EXPECT(processed_bytes.size() == 4);
|
||||
EXPECT(processed_bytes[0] == 0xA1);
|
||||
EXPECT(processed_bytes[1] == 0xB1);
|
||||
EXPECT(processed_bytes[2] == 0xD2);
|
||||
EXPECT(processed_bytes[3] == 0x71);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue