encoding-0.3: A library for various character encodingsSource codeContentsIndex
Data.Encoding
Synopsis
class Encoding enc where
encode :: enc -> String -> ByteString
encodeLazy :: enc -> String -> ByteString
encodable :: enc -> Char -> Bool
decode :: enc -> ByteString -> String
decodeLazy :: enc -> ByteString -> String
decodable :: enc -> ByteString -> Bool
data EncodingException = HasNoRepresentation Char
data DecodingException
= IllegalCharacter Word8
| UnexpectedEnd
| OutOfRange
recode :: (Encoding from, Encoding to) => from -> to -> ByteString -> ByteString
recodeLazy :: (Encoding from, Encoding to) => from -> to -> ByteString -> ByteString
data DynEncoding
encodingFromString :: String -> DynEncoding
Documentation
class Encoding enc whereSource
Represents an encoding, supporting various methods of de- and encoding. Minimal complete definition: encode, decode
Methods
encode :: enc -> String -> ByteStringSource
encodeLazy :: enc -> String -> ByteStringSource
encodable :: enc -> Char -> BoolSource
decode :: enc -> ByteString -> StringSource
decodeLazy :: enc -> ByteString -> StringSource
decodable :: enc -> ByteString -> BoolSource
show/hide Instances
data EncodingException Source
This exception type is thrown whenever something went wrong during the encoding-process.
Constructors
HasNoRepresentation CharThrown if a specific character is not representable in an encoding.
show/hide Instances
data DecodingException Source
This exception type is thrown whenever something went wrong during the decoding-process.
Constructors
IllegalCharacter Word8The sequence contained an illegal byte that couldn't be decoded.
UnexpectedEndmore bytes were needed to allow a successfull decoding.
OutOfRangethe decoded value was out of the unicode range
show/hide Instances
recode :: (Encoding from, Encoding to) => from -> to -> ByteString -> ByteStringSource
This decodes a string from one encoding and encodes it into another.
recodeLazy :: (Encoding from, Encoding to) => from -> to -> ByteString -> ByteStringSource
data DynEncoding Source
An untyped encoding. Used in System.IO.Encoding.getSystemEncoding.
show/hide Instances
encodingFromString :: String -> DynEncodingSource
Takes the name of an encoding and creates a dynamic encoding from it.
Produced by Haddock version 2.1.0