boost::urls::encode
Apply percent-encoding to a string
Synopsis
template<class CharSet>
std::size_t
encode(
char* dest,
std::size_t size,
core::string_view s,
CharSet const& unreserved,
encoding_opts opt = = {});
template<
class StringToken = string_token::return_string,
class CharSet>
StringToken::result_type
encode(
core::string_view s,
CharSet const& unreserved,
encoding_opts opt = = {},
StringToken&& token) noexcept;
Description
This function applies percent-encoding to the string using the given options and character set. The destination buffer provided by the caller is used to store the result, which may be truncated if there is insufficient space.
char buf[100];
assert( encode( buf, sizeof(buf), "Program Files", pchars ) == 15 );
Parameters
Name | Description |
---|---|
dest |
The destination buffer to write to. |
size |
The number of writable
characters pointed to by |
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. |