Skip to content

Add SmileGenerator.Feature.LENIENT_UTF_ENCODING for lenient handling of broken Unicode surrogate pairs on writing #276

@kireet

Description

@kireet

When encoding some invalid user generated data, we encounter JsonGenerationExceptions with the message Unmatched first part of surrogate pair. This didn't occur when using text serialization.

It seems there's a CBOR option to avoid this exception, CBORGenerator.Feature.LENIENT_UTF_ENCODING, but not one for Smile. It would be great to add this feature.

To reproduce, just try to serialize an invalid string, such as "\uD83D".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions