Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 2312

ghc-7.4.2-4.mga5.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>GHC.IO.Encoding</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_GHC-IO-Encoding.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">base-4.5.1.0: Basic libraries</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable</td></tr><tr><th>Stability</th><td>internal</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">GHC.IO.Encoding</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Text codecs for I/O
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span>  <a href="#t:BufferCodec">BufferCodec</a> from to state = <a href="#v:BufferCodec">BufferCodec</a> {<ul class="subs"><li><a href="#v:encode">encode</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</li><li><a href="#v:recover">recover</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</li><li><a href="#v:close">close</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li><a href="#v:getState">getState</a> :: <a href="System-IO.html#t:IO">IO</a> state</li><li><a href="#v:setState">setState</a> :: state -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li></ul>}</li><li class="src short"><span class="keyword">data</span>  <a href="#t:TextEncoding">TextEncoding</a>  = <span class="keyword">forall</span> dstate estate . <a href="#v:TextEncoding">TextEncoding</a> {<ul class="subs"><li><a href="#v:textEncodingName">textEncodingName</a> :: <a href="Data-String.html#t:String">String</a></li><li><a href="#v:mkTextDecoder">mkTextDecoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding.html#t:TextDecoder">TextDecoder</a> dstate)</li><li><a href="#v:mkTextEncoder">mkTextEncoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding.html#t:TextEncoder">TextEncoder</a> estate)</li></ul>}</li><li class="src short"><span class="keyword">type</span> <a href="#t:TextEncoder">TextEncoder</a> state = <a href="GHC-IO-Encoding.html#t:BufferCodec">BufferCodec</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> <a href="Data-Word.html#t:Word8">Word8</a> state</li><li class="src short"><span class="keyword">type</span> <a href="#t:TextDecoder">TextDecoder</a> state = <a href="GHC-IO-Encoding.html#t:BufferCodec">BufferCodec</a> <a href="Data-Word.html#t:Word8">Word8</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> state</li><li class="src short"><span class="keyword">data</span>  <a href="#t:CodingProgress">CodingProgress</a> <ul class="subs"><li>= <a href="#v:InputUnderflow">InputUnderflow</a>  </li><li>| <a href="#v:OutputUnderflow">OutputUnderflow</a>  </li><li>| <a href="#v:InvalidSequence">InvalidSequence</a>  </li></ul></li><li class="src short"><a href="#v:latin1">latin1</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:latin1_encode">latin1_encode</a> :: <a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a> -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>)</li><li class="src short"><a href="#v:latin1_decode">latin1_decode</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>, <a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a>)</li><li class="src short"><a href="#v:utf8">utf8</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf8_bom">utf8_bom</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf16">utf16</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf16le">utf16le</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf16be">utf16be</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf32">utf32</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf32le">utf32le</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:utf32be">utf32be</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:initLocaleEncoding">initLocaleEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:getLocaleEncoding">getLocaleEncoding</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:getFileSystemEncoding">getFileSystemEncoding</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:getForeignEncoding">getForeignEncoding</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:setLocaleEncoding">setLocaleEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:setFileSystemEncoding">setFileSystemEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:setForeignEncoding">setForeignEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:char8">char8</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li><li class="src short"><a href="#v:mkTextEncoding">mkTextEncoding</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:BufferCodec" class="def">BufferCodec</a> from to state </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:BufferCodec" class="def">BufferCodec</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:encode" class="def">encode</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding.html#t:CodingProgress">CodingProgress</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</dt><dd class="doc"><p>The <code>encode</code> function translates elements of the buffer <code>from</code>
 to the buffer <code>to</code>.  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 <code>to</code>, or <code>from</code> does not
 contain a complete multibyte sequence.
</p><p>The fact that as many elements as possible are translated 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><p>To allow us to use iconv as a BufferCode efficiently, character buffers are
 defined to contain lone surrogates instead of those private use characters that
 are used for roundtripping. Thus, Chars poked and peeked from a character buffer
 must undergo surrogatifyRoundtripCharacter and desurrogatifyRoundtripCharacter
 respectively.
</p><p>For more information on this, see Note [Roundtripping] in GHC.IO.Encoding.Failure.
</p></dd><dt class="src"><a name="v:recover" class="def">recover</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> from, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> to)</dt><dd class="doc"><p>The <code>recover</code> function is used to continue decoding
 in the presence of invalid or unrepresentable sequences. This includes
 both those detected by <code>encode</code> returning <code>InvalidSequence</code> and those
 that occur because the input byte sequence appears to be truncated.
</p><p>Progress will usually be made by skipping the first element of the <code>from</code>
 buffer. This function should only be called if you are certain that you
 wish to do this skipping and if the <code>to</code> buffer has at least one element
 of free space. Because this function deals with decoding failure, it assumes
 that the from buffer has at least one element.
</p><p><code>recover</code> may raise an exception rather than skipping anything.
</p><p>Currently, some implementations of <code>recover</code> may mutate the input buffer.
 In particular, this feature is used to implement transliteration.
</p></dd><dt class="src"><a name="v:close" class="def">close</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></dt><dd class="doc"><p>Resources associated with the encoding may now be released.
 The <code>encode</code> function may not be called again after calling
 <code>close</code>.
</p></dd><dt class="src"><a name="v:getState" class="def">getState</a> :: <a href="System-IO.html#t:IO">IO</a> state</dt><dd class="doc"><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></dd><dt class="src"><a name="v:setState" class="def">setState</a> :: state -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:TextEncoding" class="def">TextEncoding</a>  </p><div class="doc"><p>A <code><a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></code> 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 <code><a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></code> for UTF-8 is <code>utf8</code>.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><span class="keyword">forall</span> dstate estate . <a name="v:TextEncoding" class="def">TextEncoding</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:textEncodingName" class="def">textEncodingName</a> :: <a href="Data-String.html#t:String">String</a></dt><dd class="doc"><p>a string that can be passed to <code>mkTextEncoding</code> to
 create an equivalent <code><a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></code>.
</p></dd><dt class="src"><a name="v:mkTextDecoder" class="def">mkTextDecoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding.html#t:TextDecoder">TextDecoder</a> dstate)</dt><dd class="doc"><p>Creates a means of decoding bytes into characters: the result must not
 be shared between several byte sequences or simultaneously across threads
</p></dd><dt class="src"><a name="v:mkTextEncoder" class="def">mkTextEncoder</a> :: <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Encoding.html#t:TextEncoder">TextEncoder</a> estate)</dt><dd class="doc"><p>Creates a means of encode characters into bytes: the result must not
 be shared between several character sequences or simultaneously across threads
</p></dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:TextEncoding" class="caption collapser" onclick="toggleSection('i:TextEncoding')">Instances</p><div id="section.i:TextEncoding" class="show"><table><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:TextEncoder" class="def">TextEncoder</a> state = <a href="GHC-IO-Encoding.html#t:BufferCodec">BufferCodec</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> <a href="Data-Word.html#t:Word8">Word8</a> state</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:TextDecoder" class="def">TextDecoder</a> state = <a href="GHC-IO-Encoding.html#t:BufferCodec">BufferCodec</a> <a href="Data-Word.html#t:Word8">Word8</a> <a href="GHC-IO-Buffer.html#t:CharBufElem">CharBufElem</a> state</p></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:CodingProgress" class="def">CodingProgress</a>  </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:InputUnderflow" class="def">InputUnderflow</a></td><td class="doc"><p>Stopped because the input contains insufficient available elements,
 or all of the input sequence has been sucessfully translated.
</p></td></tr><tr><td class="src"><a name="v:OutputUnderflow" class="def">OutputUnderflow</a></td><td class="doc"><p>Stopped because the output contains insufficient free elements
</p></td></tr><tr><td class="src"><a name="v:InvalidSequence" class="def">InvalidSequence</a></td><td class="doc"><p>Stopped because there are sufficient free elements in the output
 to output at least one encoded ASCII character, but the input contains
 an invalid or unrepresentable sequence
</p></td></tr></table></div><div class="subs instances"><p id="control.i:CodingProgress" class="caption collapser" onclick="toggleSection('i:CodingProgress')">Instances</p><div id="section.i:CodingProgress" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="GHC-IO-Encoding.html#t:CodingProgress">CodingProgress</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="GHC-IO-Encoding.html#t:CodingProgress">CodingProgress</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:latin1" class="def">latin1</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>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 <code>Handle</code> using the <code><a href="GHC-IO-Encoding.html#v:latin1">latin1</a></code> encoding will result in an error.
</p></div></div><div class="top"><p class="src"><a name="v:latin1_encode" class="def">latin1_encode</a> :: <a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a> -&gt; <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a>, <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>)</p></div><div class="top"><p class="src"><a name="v:latin1_decode" class="def">latin1_decode</a> :: <a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a> -&gt; <a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="GHC-IO-Buffer.html#t:Buffer">Buffer</a> <a href="Data-Word.html#t:Word8">Word8</a>, <a href="GHC-IO-Buffer.html#t:CharBuffer">CharBuffer</a>)</p></div><div class="top"><p class="src"><a name="v:utf8" class="def">utf8</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-8 Unicode encoding
</p></div></div><div class="top"><p class="src"><a name="v:utf8_bom" class="def">utf8_bom</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-8 Unicode encoding, with a byte-order-mark (BOM; the byte
 sequence 0xEF 0xBB 0xBF).  This encoding behaves like <code><a href="GHC-IO-Encoding.html#v:utf8">utf8</a></code>,
 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></div></div><div class="top"><p class="src"><a name="v:utf16" class="def">utf16</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-16 Unicode encoding (a byte-order-mark should be used to
 indicate endianness).
</p></div></div><div class="top"><p class="src"><a name="v:utf16le" class="def">utf16le</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-16 Unicode encoding (litte-endian)
</p></div></div><div class="top"><p class="src"><a name="v:utf16be" class="def">utf16be</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-16 Unicode encoding (big-endian)
</p></div></div><div class="top"><p class="src"><a name="v:utf32" class="def">utf32</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-32 Unicode encoding (a byte-order-mark should be used to
 indicate endianness).
</p></div></div><div class="top"><p class="src"><a name="v:utf32le" class="def">utf32le</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-32 Unicode encoding (litte-endian)
</p></div></div><div class="top"><p class="src"><a name="v:utf32be" class="def">utf32be</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The UTF-32 Unicode encoding (big-endian)
</p></div></div><div class="top"><p class="src"><a name="v:initLocaleEncoding" class="def">initLocaleEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p></div><div class="top"><p class="src"><a name="v:getLocaleEncoding" class="def">getLocaleEncoding</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The Unicode encoding of the current locale
</p></div></div><div class="top"><p class="src"><a name="v:getFileSystemEncoding" class="def">getFileSystemEncoding</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The Unicode encoding of the current locale, but allowing arbitrary
 undecodable bytes to be round-tripped through it.
</p><p>This <code><a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></code> is used to decode and encode command line arguments
 and environment variables on non-Windows platforms.
</p><p>On Windows, this encoding *should not* be used if possible because
 the use of code pages is deprecated: Strings should be retrieved
 via the <a href="wide.html">wide</a> W-family of UTF-16 APIs instead
</p></div></div><div class="top"><p class="src"><a name="v:getForeignEncoding" class="def">getForeignEncoding</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>The Unicode encoding of the current locale, but where undecodable
 bytes are replaced with their closest visual match. Used for
 the <code>CString</code> marshalling functions in <a href="Foreign-C-String.html">Foreign.C.String</a>
</p></div></div><div class="top"><p class="src"><a name="v:setLocaleEncoding" class="def">setLocaleEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p></div><div class="top"><p class="src"><a name="v:setFileSystemEncoding" class="def">setFileSystemEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p></div><div class="top"><p class="src"><a name="v:setForeignEncoding" class="def">setForeignEncoding</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p></div><div class="top"><p class="src"><a name="v:char8" class="def">char8</a> :: <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>An encoding in which Unicode code points are translated to bytes
 by taking the code point modulo 256.  When decoding, bytes are
 translated directly into the equivalent code point.
</p><p>This encoding never fails in either direction.  However, encoding
 discards information, so encode followed by decode is not the
 identity.
</p></div></div><div class="top"><p class="src"><a name="v:mkTextEncoding" class="def">mkTextEncoding</a> :: <a href="Data-String.html#t:String">String</a> -&gt; <a href="System-IO.html#t:IO">IO</a> <a href="GHC-IO-Encoding.html#t:TextEncoding">TextEncoding</a></p><div class="doc"><p>Look up the named Unicode encoding.  May fail with 
</p><ul><li> <code>isDoesNotExistError</code> 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> <code>UTF-16</code>, <code>UTF-16BE</code>, <code>UTF-16LE</code>
</li><li> <code>UTF-32</code>, <code>UTF-32BE</code>, <code>UTF-32LE</code>
</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 <code>//IGNORE</code>, e.g. <code>UTF-8//IGNORE</code>, 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 <code>//TRANSLIT</code> 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
 <code>CP</code>; for example, <code>&quot;CP1250&quot;</code>.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>