Function URI::Template::PctEncode

Function Documentation

std::string URI::Template::PctEncode(const std::string &value, bool allow_reserved = false, std::size_t max_len = std::numeric_limits<size_t>::max())

Performs percent-encoding of the string.

Will percent-encode incoming value. If allow_reserved is true then the characters from reserved (as per https://tools.ietf.org/html/rfc6570#section-1.5) are not encoded. This function is idempotent, means that already encoded triplets in value will not be encoded twice.

Parameters
  • [in] value – A value to encode.

  • [in] allow_reserved – If reserved characters are allowed in the result.

  • [in] max_len – Maximum length of the result. Encoded triplets are counted as single character.

Returns

A percent-encoded representation of the value.