{-# LANGUAGE FlexibleContexts #-}
module Data.Encoding
    (module Data.Encoding.Exception
    ,module Data.Encoding.ByteSource
    ,module Data.Encoding.ByteSink
    ,Encoding(..)
    ,DynEncoding
    ,recode
    ,encodeString
    ,encodeStringExplicit
    ,decodeString
    ,decodeStringExplicit
    ,encodeLazyByteString
    ,encodeLazyByteStringExplicit
    ,decodeLazyByteString
    ,decodeLazyByteStringExplicit
    ,encodeStrictByteString
    ,encodeStrictByteStringExplicit
    ,decodeStrictByteString
    ,decodeStrictByteStringExplicit
    ,encodingFromString
    ,encodingFromStringExplicit
    )
    where

import Data.Encoding.Base
import Data.Encoding.ByteSource
import Data.Encoding.ByteSink
import Data.Encoding.Exception

import Data.Sequence
import Data.Foldable(toList)
import Data.Char

import Control.Monad.State
import Control.Monad.Identity
import Control.Monad.Error.Class
import Data.Binary.Put
import Data.Binary.Get

import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS

import Data.Encoding.ASCII
import Data.Encoding.UTF8
import Data.Encoding.UTF16
import Data.Encoding.UTF32
import Data.Encoding.ISO88591
import Data.Encoding.ISO88592
import Data.Encoding.ISO88593
import Data.Encoding.ISO88594
import Data.Encoding.ISO88595
import Data.Encoding.ISO88596
import Data.Encoding.ISO88597
import Data.Encoding.ISO88598
import Data.Encoding.ISO88599
import Data.Encoding.ISO885910
import Data.Encoding.ISO885911
import Data.Encoding.ISO885913
import Data.Encoding.ISO885914
import Data.Encoding.ISO885915
import Data.Encoding.ISO885916
import Data.Encoding.CP1250
import Data.Encoding.CP1251
import Data.Encoding.CP1252
import Data.Encoding.CP1253
import Data.Encoding.CP1254
import Data.Encoding.CP1255
import Data.Encoding.CP1256
import Data.Encoding.CP1257
import Data.Encoding.CP1258
import Data.Encoding.KOI8R
import Data.Encoding.KOI8U
import Data.Encoding.GB18030
import Data.Encoding.MacOSRoman
import Data.Encoding.JISX0201
import Data.Encoding.JISX0208
import Data.Encoding.ISO2022JP
import Data.Encoding.ShiftJIS
import Data.Encoding.CP437
import Data.Encoding.CP737
import Data.Encoding.CP775
import Data.Encoding.CP850
import Data.Encoding.CP852
import Data.Encoding.CP855
import Data.Encoding.CP857
import Data.Encoding.CP860
import Data.Encoding.CP861
import Data.Encoding.CP862
import Data.Encoding.CP863
import Data.Encoding.CP864
import Data.Encoding.CP865
import Data.Encoding.CP866
import Data.Encoding.CP869
import Data.Encoding.CP874
import Data.Encoding.CP932
import Data.Char
import Text.Regex

recode :: (Encoding enc1,Encoding enc2,ByteSource m,ByteSink m) => enc1 -> enc2 -> m ()
recode :: forall enc1 enc2 (m :: * -> *).
(Encoding enc1, Encoding enc2, ByteSource m, ByteSink m) =>
enc1 -> enc2 -> m ()
recode enc1
e1 enc2
e2 = forall (m :: * -> *) a. Monad m => m Bool -> m a -> m ()
untilM_ forall (m :: * -> *). ByteSource m => m Bool
sourceEmpty (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m Char
decodeChar enc1
e1 forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> Char -> m ()
encodeChar enc2
e2)

encodeString :: Encoding enc => enc -> String -> String
encodeString :: forall enc. Encoding enc => enc -> String -> String
encodeString enc
e String
str = forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall a. Seq a -> ViewL a
viewl forall a b. (a -> b) -> a -> b
$ forall s a. State s a -> s -> s
execState (forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> String -> m ()
encode enc
e String
str) forall a. Seq a
empty

encodeStringExplicit :: Encoding enc => enc -> String -> Either EncodingException String
encodeStringExplicit :: forall enc.
Encoding enc =>
enc -> String -> Either EncodingException String
encodeStringExplicit enc
e String
str = forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m s
execStateT (forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> String -> m ()
encode enc
e String
str) forall a. Seq a
empty forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall (m :: * -> *) a. Monad m => a -> m a
returnforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall (t :: * -> *) a. Foldable t => t a -> [a]
toListforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall a. Seq a -> ViewL a
viewl

decodeString :: Encoding enc => enc -> String -> String
decodeString :: forall enc. Encoding enc => enc -> String -> String
decodeString enc
e String
str = forall s a. State s a -> s -> a
evalState (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m String
decode enc
e) String
str

decodeStringExplicit :: Encoding enc => enc -> String -> Either DecodingException String
decodeStringExplicit :: forall enc.
Encoding enc =>
enc -> String -> Either DecodingException String
decodeStringExplicit enc
e String
str = forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
evalStateT (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m String
decode enc
e) String
str

encodeLazyByteString :: Encoding enc => enc -> String -> LBS.ByteString
encodeLazyByteString :: forall enc. Encoding enc => enc -> String -> ByteString
encodeLazyByteString enc
e String
str = Put -> ByteString
runPut forall a b. (a -> b) -> a -> b
$ forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> String -> m ()
encode enc
e String
str

encodeLazyByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException LBS.ByteString
encodeLazyByteStringExplicit :: forall enc.
Encoding enc =>
enc -> String -> Either EncodingException ByteString
encodeLazyByteStringExplicit enc
e String
str = let PutME Either EncodingException (Put, ())
g = forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> String -> m ()
encode enc
e String
str
                                     in case Either EncodingException (Put, ())
g of
                                          Left EncodingException
err -> forall a b. a -> Either a b
Left EncodingException
err
                                          Right (Put
p,()) -> forall a b. b -> Either a b
Right forall a b. (a -> b) -> a -> b
$ Put -> ByteString
runPut Put
p

decodeLazyByteString :: Encoding enc => enc -> LBS.ByteString -> String
decodeLazyByteString :: forall enc. Encoding enc => enc -> ByteString -> String
decodeLazyByteString enc
e ByteString
str = forall a. Get a -> ByteString -> a
runGet (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m String
decode enc
e) ByteString
str

decodeLazyByteStringExplicit :: Encoding enc => enc -> LBS.ByteString -> Either DecodingException String
decodeLazyByteStringExplicit :: forall enc.
Encoding enc =>
enc -> ByteString -> Either DecodingException String
decodeLazyByteStringExplicit enc
e ByteString
str = forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
evalStateT (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m String
decode enc
e) ByteString
str

encodeStrictByteString :: Encoding enc => enc -> String -> BS.ByteString
encodeStrictByteString :: forall enc. Encoding enc => enc -> String -> ByteString
encodeStrictByteString enc
e String
str = forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall a. StrictSink a -> (a, ByteString)
createStrict forall a b. (a -> b) -> a -> b
$ forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> String -> m ()
encode enc
e String
str

encodeStrictByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException BS.ByteString
encodeStrictByteStringExplicit :: forall enc.
Encoding enc =>
enc -> String -> Either EncodingException ByteString
encodeStrictByteStringExplicit enc
e String
str = let StrictSinkE StrictSink (Either EncodingException ())
g = forall enc (m :: * -> *).
(Encoding enc, ByteSink m) =>
enc -> String -> m ()
encode enc
e String
str
                                           (Either EncodingException ()
r,ByteString
bstr) = forall a. StrictSink a -> (a, ByteString)
createStrict StrictSink (Either EncodingException ())
g
                                       in case Either EncodingException ()
r of
                                            Left EncodingException
err -> forall a b. a -> Either a b
Left EncodingException
err
                                            Right ()
_  -> forall a b. b -> Either a b
Right ByteString
bstr

decodeStrictByteString :: Encoding enc => enc -> BS.ByteString -> String
decodeStrictByteString :: forall enc. Encoding enc => enc -> ByteString -> String
decodeStrictByteString enc
e ByteString
str = forall s a. State s a -> s -> a
evalState (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m String
decode enc
e) ByteString
str

decodeStrictByteStringExplicit :: Encoding enc => enc -> BS.ByteString -> Either DecodingException String
decodeStrictByteStringExplicit :: forall enc.
Encoding enc =>
enc -> ByteString -> Either DecodingException String
decodeStrictByteStringExplicit enc
e ByteString
str = forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
evalStateT (forall enc (m :: * -> *).
(Encoding enc, ByteSource m) =>
enc -> m String
decode enc
e) ByteString
str

-- | Like 'encodingFromString' but returns 'Nothing' instead of throwing an error
encodingFromStringExplicit :: String -> Maybe DynEncoding
encodingFromStringExplicit :: String -> Maybe DynEncoding
encodingFromStringExplicit String
codeName = case (String -> String
normalizeEncoding String
codeName) of
    -- ASCII
    String
"ascii"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"646"                -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"ansi_x3_4_1968"     -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"ansi_x3.4_1986"     -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"cp367"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"csascii"            -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"ibm367"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"iso646_us"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"iso_646.irv_1991"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"iso_ir_6"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"us"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    String
"us_ascii"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ASCII
ASCII
    -- UTF-8
    String
"utf_8"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF8
UTF8
    String
"u8"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF8
UTF8
    String
"utf"                -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF8
UTF8
    String
"utf8"               -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF8
UTF8
    String
"utf8_ucs2"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF8
UTF8
    String
"utf8_ucs4"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF8
UTF8
    -- UTF-16
    String
"utf_16"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF16
UTF16
    String
"u16"                -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF16
UTF16
    String
"utf16"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF16
UTF16
    -- UTF-32
    String
"utf_32"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding UTF32
UTF32
    -- KOI8-R
    String
"koi8_r"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding KOI8R
KOI8R
    String
"cskoi8r"            -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding KOI8R
KOI8R
    -- KOI8-I
    String
"koi8_u"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding KOI8U
KOI8U
    -- ISO-8859-1
    String
"iso_8859_1"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"iso8859_1"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"8859"               -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"cp819"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"csisolatin1"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"ibm819"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"iso8859"            -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"iso_8859_1_1987"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"iso_ir_100"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"l1"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"latin"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    String
"latin1"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88591
ISO88591
    -- ISO-8859-2
    String
"iso_8859_2"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    String
"iso8859_2"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    String
"csisolatin2"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    String
"iso_8859_2_1987"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    String
"iso_ir_101"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    String
"l2"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    String
"latin2"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88592
ISO88592
    -- ISO-8859-3
    String
"iso_8859_3"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    String
"iso8859_3"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    String
"csisolatin3"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    String
"iso_8859_3_1988"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    String
"iso_ir_109"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    String
"l3"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    String
"latin3"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88593
ISO88593
    --ISO-8859-4
    String
"iso_8859_4"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    String
"iso8859_4"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    String
"csisolatin4"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    String
"iso_8859_4_1988"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    String
"iso_ir_110"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    String
"l4"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    String
"latin4"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88594
ISO88594
    --ISO-8859-5
    String
"iso_8859_5"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88595
ISO88595
    String
"iso8859_5"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88595
ISO88595
    String
"csisolatincyrillic" -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88595
ISO88595
    String
"cyrillic"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88595
ISO88595
    String
"iso_8859_5_1988"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88595
ISO88595
    String
"iso_ir_144"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88595
ISO88595
    -- ISO-8859-6
    String
"iso_8859_6"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"iso8859_6"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"arabic"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"asmo_708"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"csisolatinarabic"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"ecma_114"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"iso_8859_6_1987"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    String
"iso_ir_127"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88596
ISO88596
    -- ISO-8859-7
    String
"iso_8859_7"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"iso8859_7"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"csisolatingreek"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"ecma_118"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"elot_928"           -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"greek"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"greek8"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"iso_8859_7_1987"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    String
"iso_ir_126"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88597
ISO88597
    -- ISO-8859-8
    String
"iso_8859_8"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88598
ISO88598
    String
"iso8859_8"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88598
ISO88598
    String
"csisolatinhebrew"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88598
ISO88598
    String
"hebrew"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88598
ISO88598
    String
"iso_8859_8_1988"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88598
ISO88598
    String
"iso_ir_138"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88598
ISO88598
    -- ISO-8859-9
    String
"iso_8859_9"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    String
"iso8859_9"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    String
"csisolatin5"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    String
"iso_8859_9_1989"    -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    String
"iso_ir_148"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    String
"l5"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    String
"latin5"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO88599
ISO88599
    -- ISO-8859-10
    String
"iso_8859_10"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    String
"iso8859_10"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    String
"csisolatin6"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    String
"iso_8859_10_1992"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    String
"iso_ir_157"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    String
"l6"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    String
"latin6"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885910
ISO885910
    -- ISO-8859-11
    String
"iso_8859_11"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885911
ISO885911
    String
"iso8859_11"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885911
ISO885911
    String
"thai"               -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885911
ISO885911
    String
"iso_8859_11_2001"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885911
ISO885911
    -- ISO-8859-13
    String
"iso_8859_13"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885913
ISO885913
    String
"iso8859_13"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885913
ISO885913
    -- ISO-8859-14
    String
"iso_8859_14"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    String
"iso8859_14"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    String
"iso_8859_14_1998"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    String
"iso_celtic"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    String
"iso_ir_199"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    String
"l8"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    String
"latin8"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885914
ISO885914
    -- ISO-8859-15
    String
"iso_8859_15"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885915
ISO885915
    String
"iso8859_15"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885915
ISO885915
    String
"latin9"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885915
ISO885915
    String
"l9"                 -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885915
ISO885915
    -- ISO-8859-16
    String
"iso_8859_16"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885916
ISO885916
    String
"iso8859_16"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885916
ISO885916
    String
"iso_8859_16_2001"   -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885916
ISO885916
    String
"iso_ir_226"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885916
ISO885916
    String
"l10"                -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885916
ISO885916
    String
"latin10"            -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO885916
ISO885916
    -- CP1250
    String
"cp1250"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1250
CP1250
    String
"windows_1250"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1250
CP1250
    -- CP1251
    String
"cp1251"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1251
CP1251
    String
"windows_1251"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1251
CP1251
    -- CP1252
    String
"cp1252"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1252
CP1252
    String
"windows_1252"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1252
CP1252
    -- CP1253
    String
"cp1253"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1253
CP1253
    String
"windows_1253"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1253
CP1253
    -- CP1254
    String
"cp1254"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1254
CP1254
    String
"windows_1254"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1254
CP1254
    -- CP1255
    String
"cp1255"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1255
CP1255
    String
"windows_1255"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1255
CP1255
    -- CP1256
    String
"cp1256"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1256
CP1256
    String
"windows_1256"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1256
CP1256
    -- CP1257
    String
"cp1257"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1257
CP1257
    String
"windows_1257"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1257
CP1257
    -- CP1258
    String
"cp1258"             -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1258
CP1258
    String
"windows_1258"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP1258
CP1258
    -- GB18030
    String
"gb18030"            -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding GB18030
GB18030
    String
"gb18030_2000"       -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding GB18030
GB18030
    -- MacOSRoman
    String
"macintosh"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding MacOSRoman
MacOSRoman
    -- JIS X 0201
    String
"jis_x_0201"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding JISX0201
JISX0201
    -- JIS X 0208
    String
"jis_x_0208"         -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding JISX0208
JISX0208
    -- ISO 2022-JP
    String
"iso_2022_jp"        -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ISO2022JP
ISO2022JP
    -- Shift JIS
    String
"shift_jis"          -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ShiftJIS
ShiftJIS
    String
"sjis"               -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding ShiftJIS
ShiftJIS
    -- MSDOS codepages
    String
"cp437"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP437
CP437
    String
"cp737"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP737
CP737
    String
"cp775"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP775
CP775
    String
"cp850"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP850
CP850
    String
"cp852"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP852
CP852
    String
"cp855"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP855
CP855
    String
"cp857"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP857
CP857
    String
"cp860"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP860
CP860
    String
"cp861"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP861
CP861
    String
"cp862"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP862
CP862
    String
"cp863"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP863
CP863
    String
"cp864"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP864
CP864
    String
"cp865"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP865
CP865
    String
"cp866"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP866
CP866
    String
"cp869"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP869
CP869
    String
"cp874"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP874
CP874
    String
"cp932"              -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall enc.
(Encoding enc, Eq enc, Typeable enc, Show enc) =>
enc -> DynEncoding
DynEncoding CP932
CP932
    -- defaults to nothing
    String
_                    -> forall a. Maybe a
Nothing
  where
    normalizeEncoding :: String -> String
normalizeEncoding String
s = forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower forall a b. (a -> b) -> a -> b
$ Regex -> String -> String -> String
subRegex Regex
sep String
s String
"_"
    sep :: Regex
sep = String -> Regex
mkRegex String
"[^0-9A-Za-z]+"

-- | Takes the name of an encoding and creates a dynamic encoding from it.
encodingFromString :: String -> DynEncoding
encodingFromString :: String -> DynEncoding
encodingFromString String
str = forall b a. b -> (a -> b) -> Maybe a -> b
maybe
	(forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Data.Encoding.encodingFromString: Unknown encoding: "forall a. [a] -> [a] -> [a]
++forall a. Show a => a -> String
show String
str)
	forall a. a -> a
id
	(String -> Maybe DynEncoding
encodingFromStringExplicit String
str)