/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy-Encoding.html is in libghc-text-doc 0.11.1.13-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | <!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>Data.Text.Lazy.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_Data-Text-Lazy-Encoding.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text-Lazy-Encoding.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">text-0.11.1.13: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com, rtomharper@googlemail.com,
duncan@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Data.Text.Lazy.Encoding</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Decoding ByteStrings to Text
</a><ul><li><a href="#g:2">Catchable failure
</a></li><li><a href="#g:3">Controllable error handling
</a></li></ul></li><li><a href="#g:4">Encoding Text to ByteStrings
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Functions for converting lazy <code><a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></code> values to and from lazy
<code>ByteString</code>, using several standard encodings.
</p><p>To gain access to a much larger variety of encodings, use the
<code>text-icu</code> package: <a href="http://hackage.haskell.org/package/text-icu">http://hackage.haskell.org/package/text-icu</a>
</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"><a href="#v:decodeASCII">decodeASCII</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf8">decodeUtf8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf16LE">decodeUtf16LE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf16BE">decodeUtf16BE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf32LE">decodeUtf32LE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf32BE">decodeUtf32BE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf8-39-">decodeUtf8'</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf8With">decodeUtf8With</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf16LEWith">decodeUtf16LEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf16BEWith">decodeUtf16BEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf32LEWith">decodeUtf32LEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:decodeUtf32BEWith">decodeUtf32BEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:encodeUtf8">encodeUtf8</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:encodeUtf16LE">encodeUtf16LE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:encodeUtf16BE">encodeUtf16BE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:encodeUtf32LE">encodeUtf32LE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:encodeUtf32BE">encodeUtf32BE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li></ul></div><div id="interface"><h1 id="g:1">Decoding ByteStrings to Text
</h1><div class="doc"><p>All of the single-parameter functions for decoding bytestrings
encoded in one of the Unicode Transformation Formats (UTF) operate
in a <em>strict</em> mode: each will throw an exception if given invalid
input.
</p><p>Each function has a variant, whose name is suffixed with -<code>With</code>,
that gives greater control over the handling of decoding errors.
For instance, <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf8">decodeUtf8</a></code> will throw an exception, but
<code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf8With">decodeUtf8With</a></code> allows the programmer to determine what to do on a
decoding error.
</p></div><div class="top"><p class="src"><a name="v:decodeASCII" class="def">decodeASCII</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeASCII" class="link">Source</a></p><div class="doc"><p><em>Deprecated</em>. Decode a <code>ByteString</code> containing 7-bit ASCII
encoded text.
</p><p>This function is deprecated. Use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf8">decodeUtf8</a></code> instead.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf8" class="def">decodeUtf8</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf8" class="link">Source</a></p><div class="doc"><p>Decode a <code>ByteString</code> containing UTF-8 encoded text that is known
to be valid.
</p><p>If the input contains any invalid UTF-8 data, an exception will be
thrown that cannot be caught in pure code. For more control over
the handling of invalid data, use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf8-39-">decodeUtf8'</a></code> or
<code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf8With">decodeUtf8With</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf16LE" class="def">decodeUtf16LE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf16LE" class="link">Source</a></p><div class="doc"><p>Decode text from little endian UTF-16 encoding.
</p><p>If the input contains any invalid little endian UTF-16 data, an
exception will be thrown. For more control over the handling of
invalid data, use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf16LEWith">decodeUtf16LEWith</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf16BE" class="def">decodeUtf16BE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf16BE" class="link">Source</a></p><div class="doc"><p>Decode text from big endian UTF-16 encoding.
</p><p>If the input contains any invalid big endian UTF-16 data, an
exception will be thrown. For more control over the handling of
invalid data, use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf16BEWith">decodeUtf16BEWith</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf32LE" class="def">decodeUtf32LE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf32LE" class="link">Source</a></p><div class="doc"><p>Decode text from little endian UTF-32 encoding.
</p><p>If the input contains any invalid little endian UTF-32 data, an
exception will be thrown. For more control over the handling of
invalid data, use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf32LEWith">decodeUtf32LEWith</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf32BE" class="def">decodeUtf32BE</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf32BE" class="link">Source</a></p><div class="doc"><p>Decode text from big endian UTF-32 encoding.
</p><p>If the input contains any invalid big endian UTF-32 data, an
exception will be thrown. For more control over the handling of
invalid data, use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf32BEWith">decodeUtf32BEWith</a></code>.
</p></div></div><h2 id="g:2">Catchable failure
</h2><div class="top"><p class="src"><a name="v:decodeUtf8-39-" class="def">decodeUtf8'</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="Data-Text-Encoding-Error.html#t:UnicodeException">UnicodeException</a> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf8%27" class="link">Source</a></p><div class="doc"><p>Decode a <code>ByteString</code> containing UTF-8 encoded text..
</p><p>If the input contains any invalid UTF-8 data, the relevant
exception will be returned, otherwise the decoded text.
</p><p><em>Note</em>: this function is <em>not</em> lazy, as it must decode its entire
input before it can return a result. If you need lazy (streaming)
decoding, use <code><a href="Data-Text-Lazy-Encoding.html#v:decodeUtf8With">decodeUtf8With</a></code> in lenient mode.
</p></div></div><h2 id="g:3">Controllable error handling
</h2><div class="top"><p class="src"><a name="v:decodeUtf8With" class="def">decodeUtf8With</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf8With" class="link">Source</a></p><div class="doc"><p>Decode a <code>ByteString</code> containing UTF-8 encoded text.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf16LEWith" class="def">decodeUtf16LEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf16LEWith" class="link">Source</a></p><div class="doc"><p>Decode text from little endian UTF-16 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf16BEWith" class="def">decodeUtf16BEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf16BEWith" class="link">Source</a></p><div class="doc"><p>Decode text from big endian UTF-16 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf32LEWith" class="def">decodeUtf32LEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf32LEWith" class="link">Source</a></p><div class="doc"><p>Decode text from little endian UTF-32 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:decodeUtf32BEWith" class="def">decodeUtf32BEWith</a> :: <a href="Data-Text-Encoding-Error.html#t:OnDecodeError">OnDecodeError</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -> <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a><a href="src/Data-Text-Lazy-Encoding.html#decodeUtf32BEWith" class="link">Source</a></p><div class="doc"><p>Decode text from big endian UTF-32 encoding.
</p></div></div><h1 id="g:4">Encoding Text to ByteStrings
</h1><div class="top"><p class="src"><a name="v:encodeUtf8" class="def">encodeUtf8</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Data-Text-Lazy-Encoding.html#encodeUtf8" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:encodeUtf16LE" class="def">encodeUtf16LE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Data-Text-Lazy-Encoding.html#encodeUtf16LE" class="link">Source</a></p><div class="doc"><p>Encode text using little endian UTF-16 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:encodeUtf16BE" class="def">encodeUtf16BE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Data-Text-Lazy-Encoding.html#encodeUtf16BE" class="link">Source</a></p><div class="doc"><p>Encode text using big endian UTF-16 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:encodeUtf32LE" class="def">encodeUtf32LE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Data-Text-Lazy-Encoding.html#encodeUtf32LE" class="link">Source</a></p><div class="doc"><p>Encode text using little endian UTF-32 encoding.
</p></div></div><div class="top"><p class="src"><a name="v:encodeUtf32BE" class="def">encodeUtf32BE</a> :: <a href="Data-Text-Lazy-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/bytestring-0.9.2.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a><a href="src/Data-Text-Lazy-Encoding.html#encodeUtf32BE" class="link">Source</a></p><div class="doc"><p>Encode text using big endian UTF-32 encoding.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>
|