encoding-0.8.2: A library for various character encodings

Safe HaskellNone
LanguageHaskell98

Data.Encoding

Synopsis

Documentation

class Encoding enc where Source #

The base class for all encodings. At least decodeChar, encodeChar and encodeable must be implemented.

Minimal complete definition

decodeChar, encodeChar, encodeable

Methods

decodeChar :: ByteSource m => enc -> m Char Source #

Read a single character of a ByteSource

encodeChar :: ByteSink m => enc -> Char -> m () Source #

Encode a single character and write it to a ByteSink

decode :: ByteSource m => enc -> m String Source #

Read characters from a ByteSource until it is empty

encode :: ByteSink m => enc -> String -> m () Source #

Encode a String and write it to a ByteSink

encodeable :: enc -> Char -> Bool Source #

Tests whether a given character is representable in the Encoding. If this yields True, encodeChar must not fail. If it yields False, encodeChar _must_ throw an exception.

Instances

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

data DynEncoding Source #

Wraps all possible encoding types into one data type. Used when a function needs to return an encoding.

recode :: (Encoding enc1, Encoding enc2, ByteSource m, ByteSink m) => enc1 -> enc2 -> m () Source #

encodingFromString :: String -> DynEncoding Source #

Takes the name of an encoding and creates a dynamic encoding from it.

encodingFromStringExplicit :: String -> Maybe DynEncoding Source #

Like encodingFromString but returns Nothing instead of throwing an error