:relfileprefix: ../../../
[#60D2C91A88545C274BEA6A353CCDE6B3DA514321]

= Function url_base::set_encoded_user

pass:v,q[Set the user]


== Synopsis

Declared in header `</boost/url/url_base.hpp#L678[boost/url/url_base.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/url_base.adoc[url_base]&
set_encoded_user(xref:boost/urls/pct_string_view.adoc[pct_string_view] s);
----

== Description

pass:v,q[This function sets the user part of the] pass:v,q[userinfo the the string, which may]
pass:v,q[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.]

=== Example
[,cpp]
----
assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );
----

=== Postconditions
[,cpp]
----
this->has_authority() == true && this->has_userinfo() == true
----

=== 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.]

=== 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`

|===



