-
-
Notifications
You must be signed in to change notification settings - Fork 512
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
Non-Latin-1 characters in the "parameters" metadata are being stored directly within a tEXt chunk. This violates the PNG specification (ISO-8859-1) and results in character corruption (mojibake) when the file is read by standard-compliant parsers.
Expected
When the parameters chunk contains non-Latin-1 characters:
- The
parametersshould be stored in an iTXt chunk. - OR
- Any non-Latin-1 characters should be Unicode-escaped if they are kept within a tEXt chunk.
Bug
- Non-Latin-1 characters are stored directly as raw bytes in the
tEXtchunk without escaping.- This violates the PNG specification, which requires
tEXtchunk content to be ISO-8859-1 (Latin-1). - As a result, character corruption (mojibake) occurs in standard-compliant parsers (e.g.,
テストbecomesã��ã�¹ã��).
- This violates the PNG specification, which requires
Steps to reproduce
- Generate an image using a prompt that contains non-Latin-1 characters (e.g.,
テスト). - Inspect the
parameterschunk of the generated PNG file.
Sidenote
- ComfyUI addresses this by using Unicode escaping while maintaining the use of
tEXtchunks. - Most other tools (especially A1111 derivatives, for compatibility with the
parameterschunk content) switch fromtEXttoiTXtchunks when the content includes non-Latin-1 characters.
I noticed this while developing my @enslo/sd-metadata library. Technically, this might be a minor point, but I wanted to let you know for better specification compliance.
Version
2.16.0-dev.1+597a23f
What Operating System are you using?
Windows
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working