Write a string with percent-decoding into a buffer.
Defined in header <boost/url/pct_encoding.hpp>
template< class CharSet> result< std::size_t > pct_decode( char* dest, char const* end, string_view s, CharSet const& allowed, pct_decode_opts const& opt = {});
This function applies percent-decoding to the given percent-encoded string, by converting escape sequences into their character equivalent. The function returns the number of bytes written to the destination buffer, which may be less than the size of the output area.
char *dest = new char[MAX_LENGTH]; error_code ec; std::size_t decoded_size = pct_decode( dest, dest + MAX_LENGTH, "Program%20Files", ec, pchars, pct_decode_opts{}); assert( ! ec.failed() ); assert( decoded_size == 13 ); assert( strncmp( "Program Files", dest, decoded_size ) == 0 );
Throws nothing.
The number of bytes written to the destination buffer, which does not include
any null termination. If the destination buffer is too small to hold the
result, the result is set to error::no_space
.
Name |
Description |
---|---|
|
A pointer to the beginning of the output buffer. |
|
A pointer to one past the end of the output buffer. |
|
The string to decode. |
|
The options for decoding. 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 |
pct_decode_bytes_unchecked
, pct_decode_opts
,
pct_decode_unchecked
. validate_pct_encoding
.
Convenience header <boost/url.hpp>