|
Boost : |
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2021-10-12 21:15:16
On Tue, Oct 12, 2021 at 1:02 PM Alex Christensen <achristensen_at_[hidden]> wrote:
> at some point you may run into issues with people trying to give
> your library input like http://example.com/%f0%9f%92© and expecting the
> URL parser to normalize it to http://example.com/%F0%9F%92%A9
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" );
This will produce:
assert( u.encoded_url() == "http://example.com/%f0%9f%92%a9" );
Is this what you meant? I'm guessing that the turd emoji is inserted
into the C++ source file as a utf-8 encoded code point, so that's what
you get in the string literal.
Thanks
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk