[#boost-urls-static_url-set_encoded_zone_id-0b]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/static_url.adoc[static&lowbar;url]::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/static_url.hpp#L389[boost&sol;url&sol;static&lowbar;url&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/static_url.adoc[static&lowbar;url]&
set&lowbar;encoded&lowbar;zone&lowbar;id(xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view] const& 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[RFC 6874]

== Return Value

`&ast;this`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *s*
| The zone ID to set&period;
|===


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