:relfileprefix: ../../
[#5EAF2405CF5AFC5E41A669F5AB83ACCECB732788]

= Function encoded_size

pass:v,q[Return the buffer size needed for percent-encoding]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class CharSet>
size_t
encoded_size(
    string_view s,
    const CharSet& unreserved,
    xref:boost/urls/encoding_opts.adoc[encoding_opts] opt = = {}) noexcept;
----

== Description

pass:v,q[This function returns the exact number] pass:v,q[of bytes necessary to store the result]
pass:v,q[of applying percent-encoding to the]
pass:v,q[string using the given options and]
pass:v,q[character set.]
pass:v,q[No encoding is actually performed.]

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

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

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2.1. Percent-Encoding (rfc3986)]



== Return Value

* `size_t` 


== Parameters

|===
| Name | Type 

| *s*
| `string_view`

| *unreserved*
| ``

| *opt*
| `encoding_opts`

|===



