Skip to content

parse_unicode_url function #882

Description

@alandefreitas

We should have a function to handle unicode urls:

result<url> 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:

result<url>
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<url>
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));
    // ...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UnactionableWe're using the issue for discussion about ideas we don't we want to implement yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions