binary
binary copied to clipboard
UTF-8 validation when deserializing
As pointed out in #70 by @ttuegel we don't do validation of UTF-8 when decoding. This needs to be fixed.
Consider introducing getList in Binary if it makes a big difference for performance. With getList we could use some of the faster UTF-8 validators without having to write our own. See how text does utf8 validation . Our case might be more difficult though as we don't know beforehand whether all input bytes are available.
class Binary a where
-- ...
getList :: [a]
getList = getDefaultList
getDefaultList :: Binary a => Get [a]
getDefaultList = get >>= getMany
class Binary Char where
-- ...
getList = -- faster code