On 13/10/2021 10:15, Vinnie Falco wrote:
Okay, I think what you're saying is that you will have this string literal:
string_view s = "http://example.com/\xf0\x9f\x92\xa9";
Unfortunately, this is not a valid URL and I don't think that the library should accept this input. However, you could write this:
url u = parse_uri( "http://example.com" ).value();
u.set_path( "/\xf0\x9f\x92\xa9" );
Why would set_path accept encoding that parse_uri does not? That sounds like a red flag. I note in the docs that there is also a set_encoded_path, which implies that set_path might be "unencoded", which might explain it -- but set_path has no documentation, so this is unclear. On an unrelated note, set_query_part seems wrong, it should have a leading question mark but the BNF specifies a leading hash. Also it claims its input is an encoded string, which seems inconsistently named with set_encoded_query (which in turn mentions fragments in its docs, which also seems wrong).