Module Http.Pct

Percent-encoding codec.

Percent-encoding codecs according to RFC 3986.

Note. This should not be used for URI query strings and application/x-www-form-urlencoded which is slightly different. The Query module handles that.

type kind = [
  1. | `Uri_component
    (*

    Percent-encodes anything but unreserved and sub-delims URI characters. In other words only 'a'..'z', 'A'..'Z', '0'..'9', '-', '.', '_', '~' and '!', '$', '&', '\'', '(', ')' '*', '+', ',', ';', '=' are not percent-encoded.

    *)
  2. | `Uri
    (*

    Percent-encodes like `Uri_component except it also preserves gen-delims URI characters. In other words in addition to those characters above, ':', '/', '?', '#', '[', ']', '@' are not percent-encoded.

    *)
]

The kind of percent encoding.

val encode : kind -> string -> string

encode kind s is the percent encoding of s according to kind.

val decode : string -> string

decode s is the percent decoding of s.