Module Kxclib.Url_encoding

encode / decode a string according to the RFC 3986 Section 2.1 URI Generic Syntax - Percent-Encoding syntax

val encode_buf : ?offset:int -> ?len:int -> Stdlib.Buffer.t -> bytes -> int

Takes an input bytes, and writes the encoded string to Buffer.t.

  • parameter offset

    the offset of input which the encoder should start reading from.

  • parameter len

    the length of input which the encoder should read.

  • returns

    the number of bytes written to Buffer.t.

val decode_buf : ?offset:int -> ?len:int -> Stdlib.Buffer.t -> string -> int

Takes an input string, and writes the decoded bytes to Buffer.t.

  • parameter offset

    the offset of input which the decoder should start reading from.

  • parameter len

    the length of input which the decoder should read.

  • returns

    the number of bytes written to Buffer.t.

val encode : ?offset:int -> ?len:int -> bytes -> string

Takes an input bytes, and returns the encoded string.

  • parameter offset

    the offset of input which the encoder should start reading from.

  • parameter len

    the length of input which the encoder should read.

val decode : ?offset:int -> ?len:int -> string -> bytes

Takes an input string, and returns the decoded bytes.

  • parameter offset

    the offset of input which the decoder should start reading from.

  • parameter len

    the length of input which the decoder should read.

exception Invalid_url_encoded_string of [ `reserved_character_in_encoded_string of char * int | `invalid_percent_encoded_character of string * int | `percent_encoded_character_end_of_input of int ]