:relfileprefix: ../../../
[#E4CDAC99B5C36926B677F962FFF03E1A69438035]

= Function url_view_base::encoded_zone_id

pass:v,q[Return the IPv6 Zone ID]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/pct_string_view.adoc[pct_string_view]
encoded_zone_id() const noexcept;
----

== Description

pass:v,q[If the host type is] xref:boost/urls/host_type/ipv6.adoc[host_type::ipv6,]
pass:v,q[this function returns the Zone ID as]
pass:v,q[a string. Otherwise an empty string is returned.]
pass:v,q[The returned string may contain]
pass:v,q[percent escapes.]

=== Example
[,cpp]
----
assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" );
----

=== Complexity
pass:v,q[Constant.]

=== Exception Safety
pass:v,q[Throws nothing.]

=== BNF
[,cpp]
----
host        = IP-literal / IPv4address / reg-name

IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture  ) "]"

ZoneID = 1*( unreserved / pct-encoded )

IPv6addrz = IPv6address "%25" ZoneID
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers]



== Return Value

* `pct_string_view` 




