<boost/url/encode.hpp>
template<
string_token::StringToken StringToken = string_token::return_string,
grammar::CharSet CS>
StringToken::result_type
encode(
core::string_view s,
CS const& allowed,
encoding_opts opt = {},
StringToken&& token = {}) noexcept;
This function applies percent-encoding to the string using the given options and character set, and returns the result as a string when called with default arguments.
encoding_opts opt;
opt.space_as_plus = true;
std::string s = encode( "My Stuff", opt, pchars );
assert( s == "My+Stuff" );
Calls to allocate may throw.
Name | Description |
---|---|
s | The string to encode. |
allowed | 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. |