:relfileprefix: ../../../ [#C7A49EF393D44572C355491CD2720C7EBCB84169] = Function url::set_encoded_host_name pass:v,q[Set the host to a name] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/url.adoc[url]& set_encoded_host_name(xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- == Description pass:v,q[The host is set to the specified string,] pass:v,q[which may contain percent-escapes and] pass:v,q[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.] pass:v,q[The host type is] xref:boost/urls/host_type/name.adoc[host_type::name.] === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === 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] ---- reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[ 3.2.2. Host (rfc3986)] == Return Value * `` == Parameters |=== | Name | Type | *s* | `pct_string_view` |===