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

Safe Haskell | Safe-Inferred
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) Source #

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 Source #

Constructors

ConformantUTF8 |
GeneralisedUTF8 |

#### Instances

Instances details

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

decodeGenUTF8 :: ByteArray -> String Source #

# Utilities

isSurrogate :: Char -> Bool Source #

Is a `Char` a UTF-16 surrogate?

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

Is the given byte sequence valid under the given encoding?