Voice host: force UTF-8 mode for bundled Python (fixes silent TTS on non-CJK Windows) - #8
Open
insxnsive wants to merge 1 commit into
Open
Voice host: force UTF-8 mode for bundled Python (fixes silent TTS on non-CJK Windows)#8insxnsive wants to merge 1 commit into
insxnsive wants to merge 1 commit into
Conversation
Fixes the 'charmap' codec crash that silences TTS on non-CJK Windows locales (cp1252/cp1251/etc.). PYTHONUTF8=1 (PEP 540) makes stdout/stderr and file I/O UTF-8 for the spawned GPT-SoVITS process regardless of the system ANSI code page.
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.
Problem
On any Windows system whose ANSI code page cannot represent CJK characters, Lilith's voice is completely silent.
The voice host launches the bundled GPT-SoVITS Python with its stdout/stderr redirected to pipes. On Windows, Python then encodes all output using the locale's ANSI code page. GPT-SoVITS prints the Chinese/Japanese reference transcript on every TTS request, so on cp1252 (all Western European and Latin American locales, incl. en-US and pt-BR), cp1251 (Cyrillic), cp1253, cp1254, cp1256 and others, every request raises:
The API returns
400 {"message":"tts failed", ...}and the mod gives up after its retry window — text chat works, but Lilith never speaks. In practice this affects effectively every non-CJK Windows locale; even Japanese/Korean code pages fail on the mod's Traditional Chinese text.Fix
Set
PYTHONUTF8=1on the spawned Python process. This enables Python's official UTF-8 mode (PEP 540): stdout/stderr and file I/O become UTF-8 regardless of locale, fixing both the Chinese (zh) and Japanese (ja) voice services on all systems.Testing
Reproduced on a pt-BR Windows system (cp1252): every TTS request returned the charmap 400. With the fix, both Chinese and English synthesis return
200with valid WAV audio (~9s for a sentence on CPU).Notes
averaged_perceptron_tagger_eng,cmudict) that are not bundled in the voice runtime — tracked in Voice runtime is missing NLTK data: English replies always fail TTS #7.