Skip to content

fix: specify UTF-8 encoding when reading style files#10

Open
EnragedAntelope wants to merge 1 commit into
martin-rizzo:masterfrom
EnragedAntelope:fix/unicode-decode-styles
Open

fix: specify UTF-8 encoding when reading style files#10
EnragedAntelope wants to merge 1 commit into
martin-rizzo:masterfrom
EnragedAntelope:fix/unicode-decode-styles

Conversation

@EnragedAntelope

@EnragedAntelope EnragedAntelope commented May 19, 2026

Copy link
Copy Markdown

Summary

  • file_path.read_text() in nodes/core/predefined_styles.py was called without an explicit encoding
  • On Windows the default encoding is cp1252, which cannot decode UTF-8 byte sequences present in the bundled style .txt files
  • This caused a UnicodeDecodeError at ComfyUI startup, preventing the node from loading entirely

Fix: add encoding='utf-8' to the read_text() call — a single-character change with no behaviour difference on Linux/macOS (where UTF-8 is already the default).

Reproduction

Start ComfyUI on a Windows machine with a non-UTF-8 system locale. The node fails to import with:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 6737: character maps to <undefined>

Test plan

  • Launch ComfyUI on Windows — node loads without error
  • Style files load and populate the style selector as expected

🤖 Generated with Claude Code

Python's read_text() defaults to the OS locale encoding on Windows
(cp1252), which cannot decode UTF-8 byte sequences in the style .txt
files, causing a UnicodeDecodeError at import time. Explicitly passing
encoding='utf-8' fixes the crash on all Windows locales.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@EnragedAntelope EnragedAntelope force-pushed the fix/unicode-decode-styles branch from 22a887a to 4469072 Compare May 19, 2026 14:54
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