:relfileprefix: ../../../ [#19019DF8D7BE0F7793CB87DEFB1D5CA5AE7379F5] = Function url_base::set_encoded_path pass:v,q[Set the path.] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/url_base.adoc[url_base]& set_encoded_path(xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- == Description pass:v,q[This function sets the path to the] pass:v,q[string, which may contain percent-escapes] pass:v,q[and can be empty.] pass:v,q[Escapes in the string are preserved,] pass:v,q[and reserved characters in the string] pass:v,q[are percent-escaped in the result.] [NOTE] pass:v,q[The library may adjust the final result] pass:v,q[to ensure that no other parts of the url] pass:v,q[is semantically affected.] === Example [,cpp] ---- url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" ); ---- === Complexity pass:v,q[Linear in `this->size() + s.size()`.] === Exception Safety pass:v,q[Strong guarantee.] pass:v,q[Calls to allocate may throw.] pass:v,q[Exceptions thrown on invalid input.] === BNF [,cpp] ---- path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0 ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] == Return Value * `` == Parameters |=== | Name | Type | *s* | `pct_string_view` |===