bytestring-encodings-0.2.0.2: checks to see if a given bytestring adheres to a certain encoding

Safe HaskellNone
LanguageHaskell2010

Data.ByteString.Encodings

Contents

Synopsis

ASCII

isAscii :: ByteString -> Bool Source #

O(n/8) detremine if a ByteString is ASCII-encoded.

UTF-8

isUtf8 :: ByteString -> Bool Source #

isUtf8 firsts calls the very fast isAscii to see if the data is ASCII (and thus UTF-8). Use this if you know most of your data is ASCII-encoded. If you know that most of your data is probably not UTF8-encoded, it is probably best to use isUtf8' to avoid this check.

isUtf8' :: ByteString -> Bool Source #

isUtf8' does not call isAscii. Use this if you know most of your data is not ASCII-encoded. If you know that most of your data is probably ASCII-encoded, it is probably best to use isUtf8.