GHC.IO.Encoding.Failure (original) (raw)

Description

Types for specifying how text encoding/decoding fails

Synopsis

Documentation

isSurrogate :: Char -> Bool Source #

Some characters are actually "surrogate" codepoints defined for use in UTF-16. We need to signal an invalid character if we detect them when encoding a sequence of [Char](Data-Char.html#t:Char "Data.Char")s into [Word8](Data-Word.html#t:Word8 "Data.Word")s because they won't give valid Unicode.

We may also need to signal an invalid character if we detect them when encoding a sequence of [Char](Data-Char.html#t:Char "Data.Char")s into [Word8](Data-Word.html#t:Word8 "Data.Word")s because the[RoundtripFailure](GHC-IO-Encoding-Failure.html#v:RoundtripFailure "GHC.IO.Encoding.Failure") mode creates these to round-trip bytes through our internal UTF-16 encoding.