mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibUnicode: Download and parse IDNA data
This commit is contained in:
parent
cfd0a60863
commit
7d9fe44039
Notes:
sideshowbarker
2024-07-16 23:08:48 +09:00
Author: https://github.com/skyrising
Commit: 7d9fe44039
Pull-request: https://github.com/SerenityOS/serenity/pull/19414
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/nico
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/trflynn89
6 changed files with 324 additions and 30 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue