mirror of
https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git
synced 2026-07-22 14:07:56 +00:00
fix(scripts): force UTF-8 stdout/stderr in design_system.py on Windows (#390)
design_system.py prints box-drawing characters and swatches (--, OK marks, block swatches), but unlike search.py it never reconfigured stdout. On a non-UTF-8 Windows console (cp1252/gbk) running the CLI crashes with UnicodeEncodeError, the same failure reported in #112 for search.py. Mirror the wrapper search.py already uses: re-wrap stdout/stderr in a UTF-8 TextIOWrapper when the console encoding is not UTF-8. Applied to the source of truth and the synced cli/assets copy. Verified: the CLI runs clean under PYTHONIOENCODING=cp1252 (exit 0, no UnicodeEncodeError) while still emitting the box/swatch output; check:assets passes. Related to #112 (search.py is already fixed on main; this covers the remaining design_system.py instance).
This commit is contained in:
parent
7d62cd093b
commit
d86f44368d
@ -16,10 +16,18 @@ Usage:
|
||||
import csv
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from core import search, DATA_DIR
|
||||
|
||||
# Force UTF-8 for stdout/stderr to handle emojis/box-drawing chars on Windows (cp1252 default)
|
||||
if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8':
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
if sys.stderr.encoding and sys.stderr.encoding.lower() != 'utf-8':
|
||||
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||
|
||||
|
||||
# ============ CONFIGURATION ============
|
||||
REASONING_FILE = "ui-reasoning.csv"
|
||||
|
||||
@ -16,10 +16,18 @@ Usage:
|
||||
import csv
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from core import search, DATA_DIR
|
||||
|
||||
# Force UTF-8 for stdout/stderr to handle emojis/box-drawing chars on Windows (cp1252 default)
|
||||
if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8':
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
if sys.stderr.encoding and sys.stderr.encoding.lower() != 'utf-8':
|
||||
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||
|
||||
|
||||
# ============ CONFIGURATION ============
|
||||
REASONING_FILE = "ui-reasoning.csv"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user