:relfileprefix: ../../../
[#33BF8ECDEC2CC4284CBDE7114B2B57A930AA2AB6]

= Function url_view_base::encoded_fragment

pass:v,q[Return the fragment]


== Synopsis

Declared in header `</boost/url/url_view_base.hpp#L2194[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_fragment() const noexcept;
----

== Description

pass:v,q[This function returns the fragment as a] pass:v,q[string with percent-escapes.]
pass:v,q[Ownership is not transferred; the]
pass:v,q[string returned references the underlying]
pass:v,q[character buffer, which must remain valid]
pass:v,q[or else undefined behavior occurs.]

=== Example
[,cpp]
----
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" );
----

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

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

=== BNF
[,cpp]
----
fragment        = *( pchar / "/" / "?" )

pchar           = unreserved / pct-encoded / sub-delims / ":" / "@"
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3.5. Fragment (rfc3986)]



== Return Value

* `pct_string_view` 




