Module Iconv

Bindings to libiconv.

type iconv

A libiconv iconv_t value

val iconv_open : fromcode:string -> tocode:string -> iconv

See iconv_open documentation. Raises Unix_error in case something goes wrong.

val iconv_close : iconv -> unit

See iconv_close documentation. Raises Unix_error in case something goes wrong.

val iconv : iconv -> string -> string

Applies the given converter to the given string. Raises Unix_error in case something goes wrong.

val iconv_string : fromcode:string -> tocode:string -> string -> string

Convenient function to create a character converter, apply it on the given string, close the converted and return the converted string. Raises Unix_error in case something goes wrong.

val encoding_names : string list

Static list of encoding names handled by iconv.