...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Apply percent-encoding to a string.
Defined in header <boost/url/encode.hpp>
template< class CharSet> std::size_t encode( char* dest, std::size_t size, string_view s, CharSet const& unreserved, encoding_opts opt = {});
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 );
Throws nothing.
The number of characters written to the destination buffer.
Name |
Description |
---|---|
|
The destination buffer to write to. |
|
The number of writable characters pointed to by |
|
The string to encode. |
|
The set of characters that is not percent-encoded. |
|
The options for encoding. If this parameter is omitted, the default options are used. |
encode
,
encoded_size
,
make_pct_string_view
.
Convenience header <boost/url.hpp>