<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >GHC.IO.Encoding</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_GHC-IO-Encoding.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >base-4.2.0.2: Basic libraries</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >GHC.IO.Encoding</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >non-portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >internal</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >libraries@haskell.org</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >Text codecs for I/O </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3ABufferCodec" >BufferCodec</A > from to state = <A HREF="#v%3ABufferCodec" >BufferCodec</A > {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="recfield" ><A HREF="#v%3Aencode" >encode</A > :: <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > from -> <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > to -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > from, <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > to)</TD ></TR ><TR ><TD CLASS="recfield" ><A HREF="#v%3Aclose" >close</A > :: <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="recfield" ><A HREF="#v%3AgetState" >getState</A > :: <A HREF="System-IO.html#t%3AIO" >IO</A > state</TD ></TR ><TR ><TD CLASS="recfield" ><A HREF="#v%3AsetState" >setState</A > :: state -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ></TABLE >}</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3ATextEncoding" >TextEncoding</A > = <SPAN CLASS="keyword" >forall</SPAN > dstate estate . <A HREF="#v%3ATextEncoding" >TextEncoding</A > {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="recfield" ><A HREF="#v%3AmkTextDecoder" >mkTextDecoder</A > :: <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Encoding.html#t%3ATextDecoder" >TextDecoder</A > dstate)</TD ></TR ><TR ><TD CLASS="recfield" ><A HREF="#v%3AmkTextEncoder" >mkTextEncoder</A > :: <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Encoding.html#t%3ATextEncoder" >TextEncoder</A > estate)</TD ></TR ></TABLE >}</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3ATextEncoder" >TextEncoder</A > state = <A HREF="GHC-IO-Encoding.html#t%3ABufferCodec" >BufferCodec</A > <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem" >CharBufElem</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > state</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3ATextDecoder" >TextDecoder</A > state = <A HREF="GHC-IO-Encoding.html#t%3ABufferCodec" >BufferCodec</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem" >CharBufElem</A > state</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Alatin1" >latin1</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Alatin1_encode" >latin1_encode</A > :: <A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A > -> <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A >, <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Alatin1_decode" >latin1_decode</A > :: <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > -> <A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A >, <A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf8" >utf8</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf8_bom" >utf8_bom</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf16" >utf16</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf16le" >utf16le</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf16be" >utf16be</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf32" >utf32</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf32le" >utf32le</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf32be" >utf32be</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AlocaleEncoding" >localeEncoding</A > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkTextEncoding" >mkTextEncoding</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Documentation</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:BufferCodec" ><A NAME="t%3ABufferCodec" ></A ></A ><B >BufferCodec</B > from to state </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:BufferCodec" ><A NAME="v%3ABufferCodec" ></A ></A ><B >BufferCodec</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="body" COLSPAN="2" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:encode" ><A NAME="v%3Aencode" ></A ></A ><B >encode</B > :: <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > from -> <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > to -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > from, <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > to)</TD ><TD CLASS="rdoc" ><P >The <TT >encode</TT > function translates elements of the buffer <TT >from</TT > to the buffer <TT >to</TT >. It should translate as many elements as possible given the sizes of the buffers, including translating zero elements if there is either not enough room in <TT >to</TT >, or <TT >from</TT > does not contain a complete multibyte sequence. </P ><P ><TT >encode</TT > should raise an exception if, and only if, <TT >from</TT > begins with an illegal sequence, or the first element of <TT >from</TT > is not representable in the encoding of <TT >to</TT >. That is, if any elements can be successfully translated before an error is encountered, then <TT >encode</TT > should translate as much as it can and not throw an exception. This behaviour is used by the IO library in order to report translation errors at the point they actually occur, rather than when the buffer is translated. </P ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:close" ><A NAME="v%3Aclose" ></A ></A ><B >close</B > :: <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="rdoc" >Resources associated with the encoding may now be released. The <TT >encode</TT > function may not be called again after calling <TT >close</TT >. </TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:getState" ><A NAME="v%3AgetState" ></A ></A ><B >getState</B > :: <A HREF="System-IO.html#t%3AIO" >IO</A > state</TD ><TD CLASS="rdoc" ><P >Return the current state of the codec. </P ><P >Many codecs are not stateful, and in these case the state can be represented as '()'. Other codecs maintain a state. For example, UTF-16 recognises a BOM (byte-order-mark) character at the beginning of the input, and remembers thereafter whether to use big-endian or little-endian mode. In this case, the state of the codec would include two pieces of information: whether we are at the beginning of the stream (the BOM only occurs at the beginning), and if not, whether to use the big or little-endian encoding. </P ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:setState" ><A NAME="v%3AsetState" ></A ></A ><B >setState</B > :: state -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="../ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:TextEncoding" ><A NAME="t%3ATextEncoding" ></A ></A ><B >TextEncoding</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >A <TT ><A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TT > is a specification of a conversion scheme between sequences of bytes and sequences of Unicode characters. </P ><P >For example, UTF-8 is an encoding of Unicode characters into a sequence of bytes. The <TT ><A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TT > for UTF-8 is utf8. </P ></TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" ><TR ><TD CLASS="arg" ><SPAN CLASS="keyword" >forall</SPAN > dstate estate . <A NAME="v:TextEncoding" ><A NAME="v%3ATextEncoding" ></A ></A ><B >TextEncoding</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="body" COLSPAN="2" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:mkTextDecoder" ><A NAME="v%3AmkTextDecoder" ></A ></A ><B >mkTextDecoder</B > :: <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Encoding.html#t%3ATextDecoder" >TextDecoder</A > dstate)</TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:mkTextEncoder" ><A NAME="v%3AmkTextEncoder" ></A ></A ><B >mkTextEncoder</B > :: <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Encoding.html#t%3ATextEncoder" >TextEncoder</A > estate)</TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t:TextEncoder" ><A NAME="t%3ATextEncoder" ></A ></A ><B >TextEncoder</B > state = <A HREF="GHC-IO-Encoding.html#t%3ABufferCodec" >BufferCodec</A > <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem" >CharBufElem</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > state</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t:TextDecoder" ><A NAME="t%3ATextDecoder" ></A ></A ><B >TextDecoder</B > state = <A HREF="GHC-IO-Encoding.html#t%3ABufferCodec" >BufferCodec</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > <A HREF="GHC-IO-Buffer.html#t%3ACharBufElem" >CharBufElem</A > state</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:latin1" ><A NAME="v%3Alatin1" ></A ></A ><B >latin1</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The Latin1 (ISO8859-1) encoding. This encoding maps bytes directly to the first 256 Unicode code points, and is thus not a complete Unicode encoding. An attempt to write a character greater than '\255' to a Handle using the <TT ><A HREF="GHC-IO-Encoding.html#v%3Alatin1" >latin1</A ></TT > encoding will result in an error. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:latin1_encode" ><A NAME="v%3Alatin1_encode" ></A ></A ><B >latin1_encode</B > :: <A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A > -> <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A >, <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A >)</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:latin1_decode" ><A NAME="v%3Alatin1_decode" ></A ></A ><B >latin1_decode</B > :: <A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A > -> <A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="GHC-IO-Buffer.html#t%3ABuffer" >Buffer</A > <A HREF="Data-Word.html#t%3AWord8" >Word8</A >, <A HREF="GHC-IO-Buffer.html#t%3ACharBuffer" >CharBuffer</A >)</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf8" ><A NAME="v%3Autf8" ></A ></A ><B >utf8</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-8 Unicode encoding </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf8_bom" ><A NAME="v%3Autf8_bom" ></A ></A ><B >utf8_bom</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >The UTF-8 Unicode encoding, with a byte-order-mark (BOM; the byte sequence 0xEF 0xBB 0xBF). This encoding behaves like <TT ><A HREF="GHC-IO-Encoding.html#v%3Autf8" >utf8</A ></TT >, except that on input, the BOM sequence is ignored at the beginning of the stream, and on output, the BOM sequence is prepended. </P ><P >The byte-order-mark is strictly unnecessary in UTF-8, but is sometimes used to identify the encoding of a file. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf16" ><A NAME="v%3Autf16" ></A ></A ><B >utf16</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-16 Unicode encoding (a byte-order-mark should be used to indicate endianness). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf16le" ><A NAME="v%3Autf16le" ></A ></A ><B >utf16le</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-16 Unicode encoding (litte-endian) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf16be" ><A NAME="v%3Autf16be" ></A ></A ><B >utf16be</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-16 Unicode encoding (big-endian) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf32" ><A NAME="v%3Autf32" ></A ></A ><B >utf32</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-32 Unicode encoding (a byte-order-mark should be used to indicate endianness). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf32le" ><A NAME="v%3Autf32le" ></A ></A ><B >utf32le</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-32 Unicode encoding (litte-endian) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:utf32be" ><A NAME="v%3Autf32be" ></A ></A ><B >utf32be</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The UTF-32 Unicode encoding (big-endian) </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:localeEncoding" ><A NAME="v%3AlocaleEncoding" ></A ></A ><B >localeEncoding</B > :: <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" >The Unicode encoding of the current locale </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkTextEncoding" ><A NAME="v%3AmkTextEncoding" ></A ></A ><B >mkTextEncoding</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > <A HREF="GHC-IO-Encoding.html#t%3ATextEncoding" >TextEncoding</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >Look up the named Unicode encoding. May fail with </P ><UL ><LI > isDoesNotExistError if the encoding is unknown </LI ></UL ><P >The set of known encodings is system-dependent, but includes at least: </P ><UL ><LI ><PRE >UTF-8</PRE ></LI ><LI > <TT >UTF-16</TT >, <TT >UTF-16BE</TT >, <TT >UTF-16LE</TT > </LI ><LI > <TT >UTF-32</TT >, <TT >UTF-32BE</TT >, <TT >UTF-32LE</TT > </LI ></UL ><P >On systems using GNU iconv (e.g. Linux), there is additional notation for specifying how illegal characters are handled: </P ><UL ><LI > a suffix of <TT >//IGNORE</TT >, e.g. <TT >UTF-8//IGNORE</TT >, will cause all illegal sequences on input to be ignored, and on output will drop all code points that have no representation in the target encoding. </LI ><LI > a suffix of <TT >//TRANSLIT</TT > will choose a replacement character for illegal sequences or code points. </LI ></UL ><P >On Windows, you can access supported code pages with the prefix <TT >CP</TT >; for example, <TT >"CP1250"</TT >. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >