boost::urls::encode

encode overloads

Synopses

Declared in <boost/url/encode.hpp>

Return a percent‐encoded string

template<
    string_token::StringToken StringToken = string_token::return_string,
    grammar::CharSet CS>
StringToken::result_type
encode(
    core::string_view s,
    CS const& unreserved,
    encoding_opts opt = {},
    StringToken&& token = {}) noexcept;

Apply percent‐encoding to a string

template<grammar::CharSet CS>
std::size_t
encode(
    char* dest,
    std::size_t size,
    core::string_view s,
    CS const& unreserved,
    encoding_opts opt = {});

Return Value

  • The string

  • The number of characters written to the destination buffer.

Parameters

Name

Description

s

The string to encode.

unreserved

The set of characters that is not percent‐encoded.

opt

The options for encoding. If this parameter is omitted, the default options are used.

token

A string token.

dest

The destination buffer to write to.

size

The number of writable characters pointed to by dest. If this is less than encoded_size(s), the result is truncated.