Skip to content

Native image generation: keep non-ASCII prompt text intact on Windows - #2447

Merged
Matlan1 merged 2 commits into
masterfrom
fix/sdcpp-prompt-utf8-locale
Oct 15, 2026
Merged

Matlan1 merged 2 commits into
masterfrom
fix/sdcpp-prompt-utf8-locale

Conversation

@Matlan1

@Matlan1 Matlan1 commented Oct 15, 2026

Copy link
Copy Markdown
Owner

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, where tolower rewrites UTF-8 bytes. The stable-diffusion.cpp worker now sets its C runtime LC_CTYPE to C on Windows before serving requests, so the prompt bytes pass through unchanged; other platforms are not changed.

🤖 Generated with Claude Code

Matlan1 and others added 2 commits October 15, 2026 23:05
…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>
@Matlan1
Matlan1 merged commit d25816f into master Oct 15, 2026
20 checks passed
@Matlan1
Matlan1 deleted the fix/sdcpp-prompt-utf8-locale branch October 15, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant