module Encoding:sig
..end
typet =
string
Type of a character encoding
val equal : t -> t -> bool
equal e1 e2
returns whether e1
and e2
denotes the same
encoding. It does a caseless comparison of e1
or e2
without
optionnal suffixes ("//IGNORE" or "//TRANSLIT").
val system : t
The character encoding used by the system
typecode_point =
int
Type of a unicode code-point.
val recode_string : src:t -> dst:t -> string -> string
recode_string ~src ~dst str
recode str
from src
encoding
to dst
encoding.
type
decoder
Type of a decoder
val decoder : t -> decoder
Creates a decoder from an encoding-name
type
decoding_result =
| |
Dec_ok of |
(* |
| *) |
| |
Dec_need_more |
(* |
| *) |
| |
Dec_error |
(* |
| *) |
Result of a decoding operation
val decode : decoder -> string -> int -> int -> decoding_result
decode decoder buffer ptr len
decodes with decoder
bytes at
position ptr
in buffer
type
encoder
Type of an encoder
val encoder : t -> encoder
Creates an encoder from an encoding-name
type
encoding_result =
| |
Enc_ok of |
(* |
| *) |
| |
Enc_need_more |
(* |
| *) |
| |
Enc_error |
(* |
| *) |
Result of an encoding operation
val encode : encoder ->
string -> int -> int -> code_point -> encoding_result
encode decoder buffer ptr len code
encodes code
with
encoder
at position ptr
in buffer