libdav

Module encoding

Source
Expand description

Functions for encoding and decoding percent-encoded path components.

libdav follows the same convention, and so should dependant software:

  • An Uri has its path component percent-encoded. The Uri type enforces validation of this. Additionally, all Uri instances produced by this library have their component normalised with strict_percent_encoded.
  • href strings shall have only reserved characters percent-encoded. This makes them better suitable for display, and for usage in filenames. These are frequently encoded into XML, so do not require escaping non-reserved characters. Handling of XML entities is done internally by libdav; consumers need not concern themselves with this.

Hrefs should be treated as opaque strings. These MAY be percent-encoded, but keep in mind that decoding them and re-encoding them may not yield the same result. From RFC3986, section 2.2:

URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent. Percent- encoding a reserved character, or decoding a percent-encoded octet that corresponds to a reserved character, will change how the URI is interpreted by most applications. Thus, characters in the reserved set are protected from normalization and are therefore safe to be used by scheme-specific and producer-specific algorithms for delimiting data subcomponents within a URI.

See this short article for more details.

Enums§

Functions§