package mrmime

  1. Overview
  2. Docs

Module Mrmime.Encoded_wordSource

Sourcetype charset = [
  1. | `UTF_8
  2. | `UTF_16
  3. | `UTF_16BE
  4. | `UTF_16LE
  5. | Rosetta.encoding
  6. | `US_ASCII
  7. | `Charset of string
]
Sourcetype encoding =
  1. | Quoted_printable
  2. | Base64

Base64 encoding.

Inline quoted-printable encoding.

Sourcetype t = {
  1. charset : charset;
  2. encoding : encoding;
  3. data : (string, [ `Msg of string ]) result;
}
Sourceval is_normalized : t -> bool
Sourceval make : encoding:encoding -> string -> (t, [ `Msg of string ]) result

make ~encoding x returns an encoded word according encoding (Quoted Printable encoding or Base64 encoding). x must be a valid UTF-8 string. charset of encoded word will be, by the way, "UTF-8".

NOTE: If you expect to generate an encoded word with something else than UTF-8 (like latin1), we decided to not handle this case and just produce valid UTF-8 contents in any cases.

Sourceval make_exn : encoding:encoding -> string -> t

Alias of make but raises an Invalid_argument if it fails.

Accessors.

Sourceval encoding : t -> encoding
Sourceval charset : t -> charset
Sourceval data : t -> (string, [ `Msg of string ]) result

Pretty-printer.

Sourceval pp_charset : Format.formatter -> charset -> unit
Sourceval pp_encoding : Format.formatter -> encoding -> unit
Sourceval pp : Format.formatter -> t -> unit

Equal.

Sourceval equal_charset : charset -> charset -> bool
Sourceval equal_encoding : encoding -> encoding -> bool
Sourceval equal : t -> t -> bool
Sourceval charset_of_string : string -> charset

charset_of_string s returns charset of well-formed charset identifier s (according IANA).

Sourceval charset_to_string : charset -> string
Sourceval normalize_to_utf8 : charset:charset -> string -> (string, [ `Msg of string ]) result

normalize_to_utf8 ~charset s maps a source s which is encoded with the charset charset and try to map/normalize it to UTF-8.

Sourceval of_string : string -> (t, [ `Msg of string ]) result

of_string v tries to parse v as an encoded-word (according RFC 2047).

Decoders.

Sourcemodule Decoder : sig ... end

Encoders.

Sourcemodule Encoder : sig ... end
OCaml

Innovation. Community. Security.