Skip to content

Question about decoding over-flexibility #10

@rpeszek

Description

@rpeszek

I have been trying to use this package, I am also trying to bridge it to my typed-encoding project.
I have more of a question than an issue:

decodeXyz functions seem to be overly permissive. Here is an example of decoding an invalid ASCII ByteString:

>>> decodeStrictByteStringExplicit ASCII "\239"
Right "\239"

Here is a UTF8 example:

>>> decodeStrictByteStringExplicit UTF8 "\192\NUL"
Right "\NUL"
>>> encodeStrictByteStringExplicit UTF8 "\NUL"
"\NUL"

I imagine this is just part of the design.
Is there a way to check that encoded text is valid other than
a round trip decodeXyz followed by encodeXyz to see if the outcome is the same?

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions