<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="Up" href="CharEncoding.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="CaseMap" rel="Chapter" href="CaseMap.html"> <link title="CharEncoding" rel="Chapter" href="CharEncoding.html"> <link title="Default" rel="Chapter" href="Default.html"> <link title="IMap" rel="Chapter" href="IMap.html"> <link title="ISet" rel="Chapter" href="ISet.html"> <link title="Locale" rel="Chapter" href="Locale.html"> <link title="Main" rel="Chapter" href="Main.html"> <link title="OOChannel" rel="Chapter" href="OOChannel.html"> <link title="SubText" rel="Chapter" href="SubText.html"> <link title="UCS4" rel="Chapter" href="UCS4.html"> <link title="UChar" rel="Chapter" href="UChar.html"> <link title="UCharInfo" rel="Chapter" href="UCharInfo.html"> <link title="UCharTbl" rel="Chapter" href="UCharTbl.html"> <link title="UCol" rel="Chapter" href="UCol.html"> <link title="ULine" rel="Chapter" href="ULine.html"> <link title="UMap" rel="Chapter" href="UMap.html"> <link title="UNF" rel="Chapter" href="UNF.html"> <link title="UPervasives" rel="Chapter" href="UPervasives.html"> <link title="URe" rel="Chapter" href="URe.html"> <link title="UReStr" rel="Chapter" href="UReStr.html"> <link title="USet" rel="Chapter" href="USet.html"> <link title="UTF16" rel="Chapter" href="UTF16.html"> <link title="UTF8" rel="Chapter" href="UTF8.html"> <link title="UText" rel="Chapter" href="UText.html"> <link title="UnicodeString" rel="Chapter" href="UnicodeString.html"> <link title="XArray" rel="Chapter" href="XArray.html"> <link title="XString" rel="Chapter" href="XString.html"><title>CharEncoding.Interface</title> </head> <body> <div class="navbar"> <a href="CharEncoding.html">Up</a> </div> <center><h1>Module type <a href="type_CharEncoding.Interface.html">CharEncoding.Interface</a></h1></center> <br> <pre><span class="keyword">module type</span> Interface = <code class="code">sig</code> <a href="CharEncoding.Interface.html">..</a> <code class="code">end</code></pre><hr width="100%"> <br> Module for character encodings.<br> <pre><span class="keyword">exception</span> <a name="EXCEPTIONMalformed_code"></a>Malformed_code</pre> <div class="info"> Failure of decoding<br> </div> <pre><span class="keyword">exception</span> <a name="EXCEPTIONOut_of_range"></a>Out_of_range</pre> <div class="info"> Failure of encoding<br> </div> <pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> <div class="info"> Type for encodings.<br> </div> <pre><span class="keyword">val</span> <a name="VALautomatic"></a>automatic : <code class="type">string -><br> <a href="CharEncoding.Interface.html#TYPEt">t</a> list -><br> <a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">automatic name [enc_1; enc_2; ... enc_n] enc</code> creates the new encoding <code class="code">name</code> doing automatic encoding detection among <code class="code">enc_1</code>, <code class="code">enc_2</code>, ..., <code class="code">enc_n</code> by the given order. <code class="code">enc</code> is used for encoding.<br> </div> <pre><span class="keyword">val</span> <a name="VALnew_enc"></a>new_enc : <code class="type">string -> <a href="CharEncoding.Interface.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">new_enc name enc</code> registers the new encoding <code class="code">enc</code> under the name <code class="code">name</code><br> </div> <pre><span class="keyword">val</span> <a name="VALalias"></a>alias : <code class="type">string -> string -> unit</code></pre><div class="info"> <code class="code">alias alias name</code> : Define <code class="code">alias</code> as an alias of the encoding with the name <code class="code">name</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALof_name"></a>of_name : <code class="type">string -> <a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><div class="info"> 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.<br> </div> <pre><span class="keyword">val</span> <a name="VALname_of"></a>name_of : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> string</code></pre><div class="info"> Returns the name of the encoding.<br> </div> <br> Shortcuts<br> <pre><span class="keyword">val</span> <a name="VALascii"></a>ascii : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALlatin1"></a>latin1 : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf8"></a>utf8 : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf16"></a>utf16 : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf16be"></a>utf16be : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf16le"></a>utf16le : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf32"></a>utf32 : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf32be"></a>utf32be : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALutf32le"></a>utf32le : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALucs4"></a>ucs4 : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALrecode_string"></a>recode_string : <code class="type">in_enc:<a href="CharEncoding.Interface.html#TYPEt">t</a> -><br> out_enc:<a href="CharEncoding.Interface.html#TYPEt">t</a> -> string -> string</code></pre><div class="info"> <code class="code">recode_string ~in_enc ~out_enc s</code> converts the string <code class="code">s</code> from <code class="code">in_enc</code> to <code class="code">out_enc</code>.<br> </div> <pre><span class="keyword">class</span> <a name="TYPEuchar_input_channel_of"></a><a href="CharEncoding.Interface.uchar_input_channel_of.html">uchar_input_channel_of</a> : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="OOChannel.char_input_channel.html">OOChannel.char_input_channel</a> -> </code><code class="type">[<a href="UChar.html#TYPEt">UChar.t</a>]</code> <code class="type"><a href="OOChannel.obj_input_channel.html">OOChannel.obj_input_channel</a></code></pre><div class="info"> <code class="code">new uchar_input_channel_of enc c_in</code> creates the new intput channel which convert characters to Unicode using encoding <code class="code">enc</code>. </div> <pre><span class="keyword">class</span> <a name="TYPEuchar_output_channel_of"></a><a href="CharEncoding.Interface.uchar_output_channel_of.html">uchar_output_channel_of</a> : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="OOChannel.char_output_channel.html">OOChannel.char_output_channel</a> -> </code><code class="type">[<a href="UChar.html#TYPEt">UChar.t</a>]</code> <code class="type"><a href="OOChannel.obj_output_channel.html">OOChannel.obj_output_channel</a></code></pre><div class="info"> <code class="code">new uchar_ouput_channel_of enc c_out</code> creates the new output channel which convert Unicode to its byte representation using encoding <code class="code">enc</code>. </div> <pre><span class="keyword">class</span> <a name="TYPEconvert_uchar_input"></a><a href="CharEncoding.Interface.convert_uchar_input.html">convert_uchar_input</a> : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="UChar.html#TYPEt">UChar.t</a> <a href="OOChannel.obj_input_channel.html">OOChannel.obj_input_channel</a> -> </code><code class="type"><a href="OOChannel.char_input_channel.html">OOChannel.char_input_channel</a></code></pre><div class="info"> <code class="code">new convert_uchar_input enc c_in</code> creates the new channel which convert Unicode input to its byte representation using encoding <code class="code">enc</code>. </div> <pre><span class="keyword">class</span> <a name="TYPEconvert_uchar_output"></a><a href="CharEncoding.Interface.convert_uchar_output.html">convert_uchar_output</a> : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="UChar.html#TYPEt">UChar.t</a> <a href="OOChannel.obj_output_channel.html">OOChannel.obj_output_channel</a> -> </code><code class="type"><a href="OOChannel.char_output_channel.html">OOChannel.char_output_channel</a></code></pre><div class="info"> <code class="code">new convert_uchar_output enc c_in</code> creates the new channel which convert character output to Unicode using encoding <code class="code">enc</code>. </div> <pre><span class="keyword">class</span> <a name="TYPEconvert_input"></a><a href="CharEncoding.Interface.convert_input.html">convert_input</a> : <code class="type">in_enc:<a href="CharEncoding.Interface.html#TYPEt">t</a> -> out_enc:<a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="OOChannel.char_input_channel.html">OOChannel.char_input_channel</a> -> </code><code class="type"><a href="OOChannel.char_input_channel.html">OOChannel.char_input_channel</a></code></pre><div class="info"> <code class="code">new convert_input in_enc out_enc c_in</code> create the new input channel using encoding <code class="code">out_enc</code> from the input channel using encoding <code class="code">in_enc</code> </div> <pre><span class="keyword">class</span> <a name="TYPEconvert_output"></a><a href="CharEncoding.Interface.convert_output.html">convert_output</a> : <code class="type">in_enc:<a href="CharEncoding.Interface.html#TYPEt">t</a> -> out_enc:<a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="OOChannel.char_output_channel.html">OOChannel.char_output_channel</a> -> </code><code class="type"><a href="OOChannel.char_output_channel.html">OOChannel.char_output_channel</a></code></pre><div class="info"> <code class="code">new convert_ouput in_enc out_enc c_in</code> create the new output channel using encoding <code class="code">in_enc</code> from the output channel using encoding <code class="code">out_enc</code> </div> <pre><span class="keyword">class</span> <a name="TYPEout_channel"></a><a href="CharEncoding.Interface.out_channel.html">out_channel</a> : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> Pervasives.out_channel -> </code><code class="type">[<a href="UChar.html#TYPEt">UChar.t</a>]</code> <code class="type"><a href="OOChannel.obj_output_channel.html">OOChannel.obj_output_channel</a></code></pre><div class="info"> <code class="code">new out_channel enc outchan</code> creates the output channel object <a href="OOChannel.obj_output_channel.html"><code class="code">OOChannel.obj_output_channel</code></a> which receives Unicode characters and outputs them to <code class="code">outchan</code> using the encoding <code class="code">enc</code>. </div> <pre><span class="keyword">class</span> <a name="TYPEin_channel"></a><a href="CharEncoding.Interface.in_channel.html">in_channel</a> : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> Pervasives.in_channel -> </code><code class="type">[<a href="UChar.html#TYPEt">UChar.t</a>]</code> <code class="type"><a href="OOChannel.obj_input_channel.html">OOChannel.obj_input_channel</a></code></pre><div class="info"> <code class="code">new in_channel enc inchan</code> creates the intput channel object <a href="OOChannel.obj_input_channel.html"><code class="code">OOChannel.obj_input_channel</code></a> which reads bytes from <code class="code">inchan</code> and converts them to Unicode characters. </div> <pre><span class="keyword">val</span> <a name="VALustream_of"></a>ustream_of : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> char Stream.t -> <a href="UChar.html#TYPEt">UChar.t</a> Stream.t</code></pre><div class="info"> <code class="code">ustream_of enc chars</code> converts the byte stream <code class="code">chars</code> to the Unicode character stream by the encoding <code class="code">enc</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALchar_stream_of"></a>char_stream_of : <code class="type"><a href="CharEncoding.Interface.html#TYPEt">t</a> -> <a href="UChar.html#TYPEt">UChar.t</a> Stream.t -> char Stream.t</code></pre><div class="info"> <code class="code">char_stream_of enc uchars</code> converts the Unicode character stream <code class="code">uchars</code> to the byte stream by the encoding <code class="code">enc</code><br> </div> <pre><span class="keyword">module type</span> <a href="CharEncoding.Interface.Type.html">Type</a> = <code class="code">sig</code> <a href="CharEncoding.Interface.Type.html">..</a> <code class="code">end</code></pre><pre><span class="keyword">module</span> <a href="CharEncoding.Interface.Make.html">Make</a>: <div class="sig_block"><code class="code">functor (</code><code class="code">Text</code><code class="code"> : </code><code class="type"><a href="UnicodeString.Type.html">UnicodeString.Type</a></code><code class="code">) -> </code><code class="type"><a href="CharEncoding.Interface.Type.html">Type</a></code><code class="type"> with type text = Text.t</code></div></pre></body></html>