serialise-0.2.6.1: A binary serialisation library for Haskell values.

Safe Haskell | None
Language | Haskell2010

Codec.Serialise.Internal.GeneralisedUTF8

Contents

- Utilities

Synopsis

- encodeGenUTF8 :: String -> (SlicedByteArray, UTF8Encoding)
- data UTF8Encoding
  - = ConformantUTF8
  - | GeneralisedUTF8
- decodeGenUTF8 :: ByteArray -> String
- isSurrogate :: Char -> Bool
- isValid :: UTF8Encoding -> [Word8] -> Bool

# Documentation

encodeGenUTF8 :: String -> (SlicedByteArray, UTF8Encoding) #

Encode a string as (generalized) UTF-8. In addition to the encoding, we return a flag indicating whether the encoded string contained any surrogate characters, in which case the output is generalized UTF-8.

data UTF8Encoding #

Constructors

ConformantUTF8 |
GeneralisedUTF8 |

#### Instances

Instances details

Show UTF8Encoding # |
Instance details Defined in Codec.Serialise.Internal.GeneralisedUTF8 Methods showsPrec :: Int -> UTF8Encoding -> ShowS # show :: UTF8Encoding -> String # showList :: [UTF8Encoding] -> ShowS #
Eq UTF8Encoding # |
Instance details Defined in Codec.Serialise.Internal.GeneralisedUTF8 Methods (==) :: UTF8Encoding -> UTF8Encoding -> Bool # (/=) :: UTF8Encoding -> UTF8Encoding -> Bool #

decodeGenUTF8 :: ByteArray -> String #

# Utilities

isSurrogate :: Char -> Bool #

Is a `Char` a UTF-16 surrogate?

isValid :: UTF8Encoding -> [Word8] -> Bool #

Is the given byte sequence valid under the given encoding?