package camomile

  1. Overview
  2. Docs
A Unicode library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

camomile-1.0.2.tbz
sha256=f0a419b0affc36500f83b086ffaa36c545560cee5d57e84b729e8f851b3d1632
sha512=7586422e68779476206027c6ebbe19b677fbe459153221f7c952c7fae374c5c8232249cb76fdb1f482069707aa1580be827cd39693906142988268b7f0e7f6d0

doc/camomile.library/CamomileLibrary/module-type-Type/CharEncoding/index.html

Module Type.CharEncodingSource

Module for character encodings.

Sourceexception Malformed_code

Failure of decoding

Sourceexception Out_of_range

Failure of encoding

Sourcetype t

Type for encodings.

Sourceval automatic : string -> t list -> t -> t

automatic name [enc_1; enc_2; ... enc_n] enc creates the new encoding name doing automatic encoding detection among enc_1, enc_2, ..., enc_n by the given order. enc is used for encoding.

Sourceval new_enc : string -> t -> unit

new_enc name enc registers the new encoding enc under the name name

Sourceval alias : string -> string -> unit

alias alias name : Define alias as an alias of the encoding with the name name.

Sourceval of_name : string -> t

Returns the encoding of the given name. Fails if the encoding is unknown. Encoding names are the same to codeset names in charmap files for the encodings defined by charmap. See charmaps directory in the source directory for the available encodings. In addition to the encodings via the charmap files, camomile supports ISO-2022-CN, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-KR, jauto (Auto detection of Japanese encodings), UTF-8, UTF-16, UTF-16BE, UTF-16LE. UTF-32, UTF-32BE, UTF-32LE, UCS-4(Big endian order). The encoding also can be referred by "IANA/<IANA name>", if the encoding is supported.

Sourceval name_of : t -> string

Returns the name of the encoding.

Shortcuts

Sourceval ascii : t
Sourceval latin1 : t
Sourceval utf8 : t
Sourceval utf16 : t
Sourceval utf16be : t
Sourceval utf16le : t
Sourceval utf32 : t
Sourceval utf32be : t
Sourceval utf32le : t
Sourceval ucs4 : t
Sourceval recode_string : in_enc:t -> out_enc:t -> string -> string

recode_string ~in_enc ~out_enc s converts the string s from in_enc to out_enc.

Sourceclass uchar_input_channel_of : t -> OOChannel.char_input_channel -> UChar.t CamomileLibrary__.OOChannel.obj_input_channel

new uchar_input_channel_of enc c_in creates the new intput channel which convert characters to Unicode using encoding enc.

Sourceclass uchar_output_channel_of : t -> OOChannel.char_output_channel -> UChar.t CamomileLibrary__.OOChannel.obj_output_channel

new uchar_ouput_channel_of enc c_out creates the new output channel which convert Unicode to its byte representation using encoding enc.

Sourceclass convert_uchar_input : t -> UChar.t OOChannel.obj_input_channel -> CamomileLibrary__.OOChannel.char_input_channel

new convert_uchar_input enc c_in creates the new channel which convert Unicode input to its byte representation using encoding enc.

Sourceclass convert_uchar_output : t -> UChar.t OOChannel.obj_output_channel -> CamomileLibrary__.OOChannel.char_output_channel

new convert_uchar_output enc c_in creates the new channel which convert character output to Unicode using encoding enc.

Sourceclass convert_input : in_enc:t -> out_enc:t -> OOChannel.char_input_channel -> CamomileLibrary__.OOChannel.char_input_channel

new convert_input in_enc out_enc c_in create the new input channel using encoding out_enc from the input channel using encoding in_enc

Sourceclass convert_output : in_enc:t -> out_enc:t -> OOChannel.char_output_channel -> CamomileLibrary__.OOChannel.char_output_channel

new convert_ouput in_enc out_enc c_in create the new output channel using encoding in_enc from the output channel using encoding out_enc

Sourceclass out_channel : t -> Pervasives.out_channel -> UChar.t CamomileLibrary__.OOChannel.obj_output_channel

new out_channel enc outchan creates the output channel object OOChannel.obj_output_channel which receives Unicode characters and outputs them to outchan using the encoding enc.

Sourceclass in_channel : t -> Pervasives.in_channel -> UChar.t CamomileLibrary__.OOChannel.obj_input_channel

new in_channel enc inchan creates the intput channel object OOChannel.obj_input_channel which reads bytes from inchan and converts them to Unicode characters.

Sourceval ustream_of : t -> char Stream.t -> UChar.t Stream.t

ustream_of enc chars converts the byte stream chars to the Unicode character stream by the encoding enc.

Sourceval char_stream_of : t -> UChar.t Stream.t -> char Stream.t

char_stream_of enc uchars converts the Unicode character stream uchars to the byte stream by the encoding enc

Sourcemodule type Type = sig ... end
OCaml

Innovation. Community. Security.