Apply percent-encoding to a string

Synopsis

Declared in header </boost/url/encode.hpp#L118[boost/url/encode.hpp,window=blank_]>

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

Description

This function applies percent-encoding to the string using the given options and character set. The destination buffer provided by the caller is used to store the result, which may be truncated if there is insufficient space.

Example

char buf[100];
assert( encode( buf, sizeof(buf), "Program Files", pchars ) == 15 );

Exception Safety

Throws nothing.

Return Value

  • size_t

Parameters

Name Type

dest

``

size

size_t

s

string_view

unreserved

``

opt

encoding_opts