:relfileprefix: ../../../ [#30BBF499D0BA121AC481D9C588E17E5BCB30D3F7] = Function url_base::set_encoded_userinfo pass:v,q[Set the userinfo.] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/url_base.adoc[url_base]& set_encoded_userinfo(xref:boost/urls/pct_string_view.adoc[pct_string_view] s); ---- == Description pass:v,q[The userinfo is set to the given string,] pass:v,q[which may contain percent-escapes.] 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 effects on the user and password] pass:v,q[depend on the presence of a colon (':')] pass:v,q[in the string:] * pass:v,q[If an unescaped colon exists, the] pass:v,q[characters up to the colon become] pass:v,q[the user and the rest of the characters] pass:v,q[after the colon become the password.] pass:v,q[In this case] xref:boost/urls/url_view_base/has_password.adoc[has_password] pass:v,q[returns] pass:v,q[true. Otherwise,] * pass:v,q[If there is no colon, the user is] pass:v,q[set to the string. The function] xref:boost/urls/url_view_base/has_password.adoc[has_password] pass:v,q[returns false.] [NOTE] pass:v,q[The interpretation of the userinfo as] pass:v,q[individual user and password components] pass:v,q[is scheme-dependent. Transmitting] pass:v,q[passwords in URLs is deprecated.] === Example [,cpp] ---- assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" ); ---- === 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] ---- userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" ) ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[ 3.2.1. User Information (rfc3986)] == Return Value * `` == Parameters |=== | Name | Type | *s* | `pct_string_view` |===