Repository navigation
Native image generation: keep non-ASCII prompt text intact on Windows - #2447
Merged
Merged
Conversation
…aches stable-diffusion.cpp intact on Windows The stable-diffusion.cpp worker sets its C runtime LC_CTYPE to C on Windows: its CLIP tokenizer lowercases prompt bytes with tolower, which under a code-page locale turns UTF-8 into invalid bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Windows, a native stable-diffusion.cpp image or video prompt containing a letter such as ß failed with "failed to encode prompt", and letters such as ä, ö and ü reached the model corrupted. stable-diffusion.cpp's CLIP tokenizer lowercases the prompt byte by byte with the C library's
tolower, and the worker process ran under the user's code-page locale, wheretolowerrewrites UTF-8 bytes. The stable-diffusion.cpp worker now sets its C runtime LC_CTYPE toCon Windows before serving requests, so the prompt bytes pass through unchanged; other platforms are not changed.🤖 Generated with Claude Code