[#boost-urls-encode-04e]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::encode
:relfileprefix: ../../
:mrdocs:


== Synopsis


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

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

[.small]#xref:boost/urls/encode-09.adoc[_» more..._]#

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    xref:boost/urls/string_token.adoc[string&lowbar;token]::xref:boost/urls/string_token/StringToken.adoc[StringToken] StringToken = xref:boost/urls/string_token.adoc[string&lowbar;token]::xref:boost/urls/string_token/return_string.adoc[return&lowbar;string],
    xref:boost/urls/grammar.adoc[grammar]::xref:boost/urls/grammar/CharSet.adoc[CharSet] CS&gt;
StringToken::result&lowbar;type
xref:boost/urls/encode-040.adoc[encode](
    core::string&lowbar;view s,
    CS const& unreserved,
    xref:boost/urls/encoding_opts.adoc[encoding&lowbar;opts] opt = &lcub;&rcub;,
    StringToken&& token = &lcub;&rcub;) noexcept;
----

[.small]#xref:boost/urls/encode-040.adoc[_» more..._]#

== Parameters


|===
| Name | Description

| *dest*
| The destination buffer    to write to&period;


| *size*
| The number of writable    characters pointed to by `dest`&period;    If this is less than `encoded&lowbar;size(s)`,    the result is truncated&period;


| *s*
| The string to encode&period;


| *unreserved*
| 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 used&period;


| *token*
| A string token&period;


|===



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