1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 07:34:59 +00:00

LibUnicode: Download and parse IDNA data

This commit is contained in:
Simon Wanner 2023-06-14 18:08:31 +02:00 committed by Tim Flynn
parent cfd0a60863
commit 7d9fe44039
6 changed files with 324 additions and 30 deletions

View file

@ -212,36 +212,6 @@ static DeprecatedString sanitize_entry(DeprecatedString const& entry)
return builder.to_deprecated_string();
}
static Vector<u32> parse_code_point_list(StringView list)
{
Vector<u32> code_points;
auto segments = list.split_view(' ');
for (auto const& code_point : segments)
code_points.append(AK::StringUtils::convert_to_uint_from_hex<u32>(code_point).value());
return code_points;
}
static Unicode::CodePointRange parse_code_point_range(StringView list)
{
Unicode::CodePointRange code_point_range {};
if (list.contains(".."sv)) {
auto segments = list.split_view(".."sv);
VERIFY(segments.size() == 2);
auto begin = AK::StringUtils::convert_to_uint_from_hex<u32>(segments[0]).value();
auto end = AK::StringUtils::convert_to_uint_from_hex<u32>(segments[1]).value();
code_point_range = { begin, end };
} else {
auto code_point = AK::StringUtils::convert_to_uint_from_hex<u32>(list).value();
code_point_range = { code_point, code_point };
}
return code_point_range;
}
static ErrorOr<void> parse_special_casing(Core::InputBufferedFile& file, UnicodeData& unicode_data)
{
Array<u8, 1024> buffer;