:relfileprefix: ../../../ [#boost-urls-static_url-set_encoded_path] == xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/static_url.adoc[pass:[static_url]]::set_encoded_path Set the path. === Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/static_url.adoc[static_url]& set_encoded_path(xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- === Description This function sets the path to the string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. [NOTE] The library may adjust the final result to ensure that no other parts of the url is semantically affected. [,cpp] ---- url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" ); ---- === Linear in `this->size() + s.size()`. === Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. [,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 ---- * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)] === Exceptions |=== | Name | Thrown on | ``s`` | contains an invalid percent-encoding. |=== === Parameters |=== | Name | Description | *s* | The string to set. |=== === See Also xref:boost/urls/url_base/encoded_segments-0e8.adoc[encoded_segments] , xref:boost/urls/url_base/segments-0e.adoc[segments] , xref:boost/urls/url_base/set_path.adoc[set_path] , xref:boost/urls/url_base/set_path_absolute.adoc[set_path_absolute] .