boostorg / boostorg/url

parse_unicode_url function

Open
#882 1 comment 1 reaction 0 assignees View on GitHub
Unactionable
Dominant language
C++
Stars
205
Forks
60
PR merge metrics
No merged PRs in 30d

Description

We should have a function to handle unicode urls:

```cpp
result parse_unicode_url(...)
```

To convert to a valid URL, the host would be converted with punycode, and other components would percent-escape when possible. Errors are still possible.

We can identify components by identifying possible delimiters (like `urls::format` does) or we can provide functions that create a URL from its components:

```cpp
result
make_url(
string_view scheme,
utf8_string_view authority,
utf8_string_view path,
utf8_string_view query,
utf8_string_view fragment)
{
url u;
u.reserve(...);
u.set_scheme(scheme);
u.set_authority(authority);
u.set_path(path);
// ...
}

result
make_iri(
string_view scheme,
utf8_string_view authority,
utf8_string_view path,
utf8_string_view query,
utf8_string_view fragment)
{
url u;
u.reserve(...);
u.set_scheme(scheme);
u.set_authority(detail::parse_punycode(authority));
u.set_path(detail::pct_encode(path));
// ...
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.