Write a string with percent-decoding into a buffer.
Defined in header <boost/url/pct_encoding.hpp>
result< std::size_t > pct_decode( char* dest, char const* end, string_view s, 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, 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.
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. |
pct_decode_bytes_unchecked
, pct_decode_opts
,
pct_decode_unchecked
. validate_pct_encoding
.
Convenience header <boost/url.hpp>