mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibTextCodec: Implement euc-kr
encoder
Implements the `euc-kr` encoder, as specified by https://encoding.spec.whatwg.org/#euc-kr-encoder
This commit is contained in:
parent
72d0e3284b
commit
826292536c
Notes:
github-actions[bot]
2024-08-08 16:51:31 +00:00
Author: https://github.com/BenJilks
Commit: 826292536c
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 ✅
4 changed files with 62 additions and 1 deletions
|
@ -43,3 +43,21 @@ TEST_CASE(test_euc_jp_encoder)
|
|||
EXPECT(processed_bytes[3] == 0xA5);
|
||||
EXPECT(processed_bytes[4] == 0xC4);
|
||||
}
|
||||
|
||||
TEST_CASE(test_euc_kr_encoder)
|
||||
{
|
||||
TextCodec::EUCKREncoder encoder;
|
||||
// U+B29F Hangul Syllable Neulh
|
||||
// U+7C97 CJK Unified Ideograph-7C97
|
||||
auto test_string = "\U0000B29F\U00007C97"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] == 0x88);
|
||||
EXPECT(processed_bytes[1] == 0x6B);
|
||||
EXPECT(processed_bytes[2] == 0xF0);
|
||||
EXPECT(processed_bytes[3] == 0xD8);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue