[#boost-urls-url_view_base-encoded_zone_id]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url_view_base]::encoded_zone_id
:relfileprefix: ../../../
:mrdocs:


Return the IPv6 Zone ID

== Synopsis


Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1438[boost/url/url_view_base.hpp]>`

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

== Description


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


=== Example

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

=== Complexity

Constant.


=== Exception Safety

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]





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