:relfileprefix: ../../../ [#E0020A33FE628A75F70D2E108483B85C951FBB3C] = Function static_url::set_encoded_query pass:v,q[Set the query] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/static_url.adoc[static_url]& set_encoded_query(xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- == Description pass:v,q[This sets the query to the string, which] pass:v,q[may contain percent-escapes and can be] pass:v,q[empty.] pass:v,q[An empty query is distinct from having] pass:v,q[no query.] 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.] === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" ); ---- === Postconditions [,cpp] ---- this->has_query() == true && this->query() == decode_view( s ); ---- === 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] ---- query = *( pchar / "/" / "?" ) query-param = key [ "=" value ] query-params = [ query-param ] *( "&" query-param ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4. Query (rfc3986)] * link:https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)] == Return Value * `` == Parameters |=== | Name | Type | *s* | `pct_string_view` |===