Module for character encodings.
Failure of decoding
Failure of encoding
Type for encodings.
new_enc name enc
registers the new encoding enc
under the name name
alias alias name
: Define alias
as an alias of
the encoding with the name name
.
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.
Shortcuts
new uchar_input_channel_of enc c_in
creates the new intput
channel which convert characters to Unicode using encoding
enc
.
new uchar_ouput_channel_of enc c_out
creates the new output
channel which convert Unicode to its byte representation using
encoding enc
.
new convert_uchar_input enc c_in
creates the new channel which
convert Unicode input to its byte representation using encoding
enc
.
new convert_uchar_output enc c_in
creates the new channel which
convert character output to Unicode using encoding enc
.
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
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
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
.
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.