Skip to content

Allow to change the strategy to handle encoding/decoding errors #86

@eldipa

Description

@eldipa

Describe the feature you'd like
If an example prints arbitrary data, there is no way to avoid a unicode encoding/decoding error.

Instead of failing, byexample could replace the offending bytes with something else (even delete them). This strategy could be set from the same --encoding parameter.

See in Python 3 help(str.encode) and the man page of Python about PYTHONIOENCODING.

Make the change backward-compatible.

Additional context (optional)
Is strict, the current strategy, the best as default? We could change it too to backslashreplace
If we choose this last one, we should add a note or warning if we perform the replace op following the line of #77 (how to detect the replacement, no idea!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsomething nice to have but it is not neither critical nor urgent

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions