Skip to content

EXIF UserComment implemented incorrectly #206

@ssokolow

Description

@ssokolow

The following test image, where the Stable Diffusion prompt metadata embedded in EXIF UserComment contains non-ASCII characters, results in a 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte error.

Judging by your source code, it's because you're "parsing" the UNICODE variant (which this spec is unclear on but appears to be UTF-16) by discarding the high bytes and parsing the low bytes as UTF-8, which blows up when UTF-8's internal bytestream self-synchronization mechanism runs into bytes that aren't either 7-bit ASCII or serendipitously look like a valid multi-byte UTF-8 subsequence.

Image

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