Home | Libraries | People | FAQ | More |
Write a string with percent-encoding into a buffer.
Defined in header <boost/url/encode.hpp>
template< class CharSet = grammar::all_chars_t> std::size_t encode( char* dest, char const* end, string_view s, encode_opts const& opt = {}, CharSet const& allowed = {});
This function applies percent-encoding to the given plain string, by escaping all characters that are not in the specified CharSet. The output is written to the destination, and will be truncated if there is insufficient space.
char *dest = new char[MAX_LENGTH]; std::size_t encoded_size = encode( dest, dest + MAX_LENGTH, "Program Files", encode_opts{}, pchars ); assert( encoded_size == 15 ); assert( strncmp( "Program%20Files", dest, encoded_size ) == 0 );
Throws nothing.
true
if the output was large
enough to hold the entire result.
Name |
Description |
---|---|
|
A pointer to the beginning of the output buffer. Upon return, the argument will be changed to one past the last character written. |
|
A pointer to one past the end of the output buffer. |
|
The string to encode. |
|
The options for encoding. If this parameter is omitted, the default options will be used. |
|
The set of characters allowed to appear unescaped. This type must
satisfy the requirements of CharSet. If this
parameter is omitted, then no characters are considered special.
The character set is ignored if |
Convenience header <boost/url.hpp>