packages feed

text-locale-encoding 0.1 → 0.1.0.1

raw patch · 3 files changed

+17/−19 lines, 3 files

Files

Data/Text/Encoding/Locale.hs view
@@ -10,7 +10,7 @@ -- This module provides functions to encode and decode 'Data.Text.Text' to/from -- 'Data.ByteString.ByteString' using 'System.IO.TextEncoding' ----- For performance, Text\'s native decode\* functions are used if the conditions+-- For performance, Text\'s native encoding functions are used if the conditions -- are right (LF NewlineMode and UTF encoding). {-# LANGUAGE CPP #-} #ifdef TRUSTWORTHY@@ -37,7 +37,6 @@  import Data.ByteString.Handle -import qualified Data.List as L import Data.Maybe  handleDecoder :: Maybe TextEncoding -> Maybe NewlineMode -> B.ByteString -> IO T.Text@@ -61,10 +60,10 @@       -- decode* functions won't convert line ends       then do         enc <- maybe getLocale' return menc-        case L.stripPrefix "UTF-" (show enc) of-          Just s ->+        case show enc of+          'U':'T':'F':'-':s ->             case s of-              "8" -> return (TE.decodeUtf8 bs)+              '8':[] -> return (TE.decodeUtf8 bs)               ('1':'6':x:'E':_)                   | 'L' == x -> return (TE.decodeUtf16LE bs)                   | 'B' == x -> return (TE.decodeUtf16BE bs)@@ -85,10 +84,10 @@       -- encode* functions won't convert line ends       then do         enc <- maybe getLocale' return menc-        case L.stripPrefix "UTF-" (show enc) of-          Just s ->+        case show enc of+          'U':'T':'F':'-':s ->             case s of-              "8" -> return (TE.encodeUtf8 bs)+              '8':[] -> return (TE.encodeUtf8 bs)               ('1':'6':x:'E':_)                   | 'L' == x -> return (TE.encodeUtf16LE bs)                   | 'B' == x -> return (TE.encodeUtf16BE bs)
Data/Text/Lazy/Encoding/Locale.hs view
@@ -1,5 +1,5 @@ -- |--- module: Data.Text.Encoding.Locale+-- module: Data.Text.Lazy.Encoding.Locale -- copyright: © kudah 2013 -- license: BSD3 --@@ -10,7 +10,7 @@ -- This module provides functions to encode and decode 'Data.Text.Lazy.Text' -- to/from 'Data.ByteString.Lazy.ByteString' using 'System.IO.TextEncoding' ----- For performance, Text\'s native decode\* functions are used if the conditions+-- For performance, Text\'s native encoding functions are used if the conditions -- are right (LF NewlineMode and UTF encoding). {-# LANGUAGE CPP #-} #ifdef TRUSTWORTHY@@ -39,7 +39,6 @@  import Data.ByteString.Handle -import qualified Data.List as L import Data.Maybe  handleDecoder :: Maybe TextEncoding -> Maybe NewlineMode -> L.ByteString -> IO TL.Text@@ -63,10 +62,10 @@       -- decode* functions won't convert line ends       then do         enc <- maybe getLocale' return menc-        case L.stripPrefix "UTF-" (show enc) of-          Just s ->+        case show enc of+          'U':'T':'F':'-':s ->             case s of-              "8" -> return (TLE.decodeUtf8 bs)+              '8':[] -> return (TLE.decodeUtf8 bs)               ('1':'6':x:'E':_)                   | 'L' == x -> return (TLE.decodeUtf16LE bs)                   | 'B' == x -> return (TLE.decodeUtf16BE bs)@@ -87,10 +86,10 @@       -- encode* functions won't convert line ends       then do         enc <- maybe getLocale' return menc-        case L.stripPrefix "UTF-" (show enc) of-          Just s ->+        case show enc of+          'U':'T':'F':'-':s ->             case s of-              "8" -> return (TLE.encodeUtf8 bs)+              '8':[] -> return (TLE.encodeUtf8 bs)               ('1':'6':x:'E':_)                   | 'L' == x -> return (TLE.encodeUtf16LE bs)                   | 'B' == x -> return (TLE.encodeUtf16BE bs)
text-locale-encoding.cabal view
@@ -1,5 +1,5 @@ name:          text-locale-encoding-version:       0.1+version:       0.1.0.1 synopsis:      Encode and decode Text to/from ByteString using TextEncoding homepage:      https://github.com/exbb2/text-locale-encoding license:       BSD3@@ -35,5 +35,5 @@      ghc-options: -Wall -    if impl(ghc>=7.2)+    if flag(trustworthy) && impl(ghc>=7.2)         cpp-options: -DTRUSTWORTHY=1