[#boost-urls-encode-0d] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::encode :relfileprefix: ../../ :mrdocs: `encode` overloads == Synopses Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encode.hpp#L119[boost/url/encode.hpp]>` Return a percent‐encoded string [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/StringToken.adoc[StringToken] StringToken = xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/return_string.adoc[return_string], xref:boost/urls/grammar.adoc[grammar]::xref:boost/urls/grammar/CharSet.adoc[CharSet] CS> StringToken::result_type xref:boost/urls/encode-04.adoc[encode]( core::string_view s, CS const& unreserved, xref:boost/urls/encoding_opts.adoc[encoding_opts] opt = {}, StringToken&& token = {}) noexcept; ---- [.small]#xref:boost/urls/encode-04.adoc[_» more..._]# Apply percent‐encoding to a string [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/grammar.adoc[grammar]::xref:boost/urls/grammar/CharSet.adoc[CharSet] CS> std::size_t xref:boost/urls/encode-09.adoc[encode]( char* dest, std::size_t size, core::string_view s, CS const& unreserved, xref:boost/urls/encoding_opts.adoc[encoding_opts] opt = {}); ---- [.small]#xref:boost/urls/encode-09.adoc[_» more..._]# == Return Value * The string * The number of characters written to the destination buffer. == Parameters [cols=2] |=== | Name | Description | *s* | The string to encode. | *unreserved* | The set of characters that is not percent‐encoded. | *opt* | The options for encoding. If this parameter is omitted, the default options are used. | *token* | A string token. | *dest* | The destination buffer to write to. | *size* | The number of writable characters pointed to by `dest`. If this is less than `encoded_size(s)`, the result is truncated. |=== == See Also xref:boost/urls/encode-04.adoc[`encode`], xref:boost/urls/encoded_size.adoc[`encoded_size`], xref:boost/urls/encoding_opts.adoc[`encoding_opts`], xref:boost/urls/encode-04.adoc[`encode`], xref:boost/urls/encoded_size.adoc[`encoded_size`], xref:boost/urls/make_pct_string_view.adoc[`make_pct_string_view`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#