Commit Graph
2 Commits
Author SHA1 Message Date
David Evans 4d655698eb Add new "best effort" decoding method for displaying UTF-8 strings (#565)
Resolves #564

For user-visible strings it's arguably better to display something. This new best-effort approach to UTF-8 decoding will ignore any invalid bytes, using only the valid ones.
2021-05-21 16:36:08 +01:00
David Evans 3719201015 New failable String.init for validating if bytes are valid UTF8 (#563)
We use String(buffer: ByteBuffer) quite a lot. This isn't ideal as it may crash if the bytes are not valid UTF-8. This PR addresses that problem by providing a failable initialiser on String that will handle invalid UTF8 bytes gracefully by returning nil.
2021-05-21 12:23:53 +01:00