boost::urls::decode :: Boost Libraries Documentation

# boost::urls::decode

Return a percent‐decoded string

## Synopsis

Declared in `<boost/url/decode.hpp>`

    template<string_token::StringToken StringToken = string_token::return_string>
    system::result<StringToken::result_type>
    decode(
        core::string_view s,
        encoding_opts opt = {},
        StringToken&& token = {});

## Description

This function percent‐decodes the specified string and returns the result using any `string_token`. The string is validated before decoding; malformed escapes cause the returned result to hold an error.

## Example

    auto plain = decode( "My%20Stuff" );
    assert( plain && *plain == "My Stuff" );

## Exception Safety

Calls to allocate may throw. Validation errors are reported in the returned result.

## Specification

- 2.1. Percent‐Encoding (rfc3986)

## Return Value

A result containing the decoded string in the format described by the passed string token.

## Parameters

Name | Description
--- | ---
s | The string to decode.
opt | The decoding options. If omitted, the default options are used.
token | A string token.

## See Also

`decode`, `decoded_size`, `encoding_opts`, `string_token::return_string`.

Created with MrDocs