Apply percent-decoding to an arbitrary string
<boost/url/decode.hpp>system::result<std::size_t>
decode(
char* dest,
std::size_t size,
core::string_view s,
encoding_opts opt = {}) noexcept;
This function percent-decodes the specified string into the destination buffer provided by the caller. The input is validated first; malformed escapes cause the returned result to hold an error instead of a size. If the buffer is too small, the output is truncated and the number of bytes actually written is returned.
char buf[100];
auto n = decode( buf, sizeof(buf), "Program%20Files" );
assert( n && *n == 13 );
Throws nothing. Validation errors are reported in the returned result.
| Name | Description |
|---|---|
| dest | The destination buffer to write to. |
| size | The number of writable characters pointed to by dest. If this is less than the decoded size, the result is truncated. |
| s | The string to decode. |
| opt | The decoding options. If omitted, the default options are used. |