[#boost-urls-url_base-set_encoded_zone_id]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_base.adoc[url&lowbar;base]::set&lowbar;encoded&lowbar;zone&lowbar;id
:relfileprefix: ../../../
:mrdocs:

Set the zone ID for an IPv6 address (percent&hyphen;encoded)&period;

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#L1412[boost&sol;url&sol;url&lowbar;base&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/url_base.adoc[url&lowbar;base]&
set&lowbar;encoded&lowbar;zone&lowbar;id(xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] s);
----

== Description

This function sets the zone ID for the host if the host is an IPv6 address&period; Escapes in the string are preserved, and reserved characters in the string are percent&hyphen;escaped in the result&period;

== Example
[,cpp]
----
assert( u.set_host_ipv6( ipv6_address( "fe80::1" ) ).set_encoded_zone_id( "eth0" ).buffer() == "https://[fe80::1%25eth0]" );
----
== Complexity
Linear in `this&hyphen;&gt;size()`&period;

== Exception Safety
Strong guarantee&period; Calls to allocate may throw&period; Exceptions thrown on invalid input&period;

== Specification
* https://datatracker.ietf.org/doc/html/rfc6874[]

== Exceptions

[cols=2]
|===
| Name
| Thrown on
| `system&lowbar;error`
| `s` contains an invalid percent&hyphen;encoding&period;
|===

== Return Value

`&ast;this`

== Parameters

[cols=2]
|===
| Name
| Description
| *s*
| The zone ID to set&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
