[#boost-urls-encoded_size]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::encoded&lowbar;size
:relfileprefix: ../../
:mrdocs:

Return the buffer size needed for percent&hyphen;encoding

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:boost/urls/grammar/CharSet.adoc[grammar::CharSet] CS&gt;
std::size&lowbar;t
encoded&lowbar;size(
    core::string&lowbar;view s,
    CS const& allowed,
    xref:boost/urls/encoding_opts.adoc[encoding&lowbar;opts] opt = &lcub;&rcub;) noexcept;
----

== Description

This function returns the exact number of bytes necessary to store the result of applying percent&hyphen;encoding to the string using the given options and character set&period; No encoding is actually performed&period;

== Example

[,cpp]
----
assert( encoded_size( "My Stuff", pchars ) == 10 );
----
== Exception Safety

Throws nothing&period;

== Specification

* https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2&period;1&period; Percent&hyphen;Encoding (rfc3986)]

== Return Value

The number of bytes needed, excluding any null terminator&period;

== Parameters

[cols=2]
|===
| Name
| Description
| *s*
| The string to measure&period;
| *allowed*
| The set of characters that is not percent&hyphen;encoded&period;
| *opt*
| The options for encoding&period; If this parameter is omitted, the default options are be used&period;
|===

== See Also

xref:boost/urls/encode-0d.adoc[`encode`], xref:boost/urls/encoding_opts.adoc[`encoding&lowbar;opts`], xref:boost/urls/make_pct_string_view.adoc[`make&lowbar;pct&lowbar;string&lowbar;view`]&period;


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