diff options
author | LepkoQQ <lepko.san@gmail.com> | 2020-06-19 23:46:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-20 17:04:03 +0200 |
commit | b1c99c189160972d7d52ebd482a4c1d7267b1c1f (patch) | |
tree | bc84d42eaec07c8be17fb99fc07621583d032c01 /AK/Tests | |
parent | 64513f3c23f880b87d26e669b777b4796b065796 (diff) | |
download | serenity-b1c99c189160972d7d52ebd482a4c1d7267b1c1f.zip |
AK: Fix JsonParser double encoding multibyte utf-8 chararcters
Diffstat (limited to 'AK/Tests')
-rw-r--r-- | AK/Tests/TestJSON.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/AK/Tests/TestJSON.cpp b/AK/Tests/TestJSON.cpp index 06a0fd0f62..31dc2c508f 100644 --- a/AK/Tests/TestJSON.cpp +++ b/AK/Tests/TestJSON.cpp @@ -118,4 +118,14 @@ TEST_CASE(json_utf8_character) EXPECT_EQ(json.as_string() == "A", true); } +TEST_CASE(json_utf8_multibyte) +{ + auto json = JsonValue::from_string("\"ลก\"").value(); + EXPECT_EQ(json.type(), JsonValue::Type::String); + EXPECT_EQ(json.as_string().is_null(), false); + EXPECT_EQ(json.as_string().length(), size_t { 2 }); + EXPECT_EQ(json.as_string() == "ลก", true); + EXPECT_EQ(json.as_string() == "\xc5\xa1", true); +} + TEST_MAIN(JSON) |