From 402c49a2839064033cf553c78773e5372e26433f Mon Sep 17 00:00:00 2001 From: Viet Tran Date: Thu, 29 Jan 2026 21:25:32 +0700 Subject: [PATCH] fix: Windows Unicode encoding error for emoji characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Force UTF-8 encoding for stdout/stderr in search.py to handle emoji characters (⚡, ✓) on Windows systems that default to cp1252. Fixes UnicodeEncodeError: 'charmap' codec can't encode character - Bump CLI version to 2.2.3 Co-Authored-By: Claude Opus 4.5 --- cli/assets/scripts/search.py | 8 ++++++++ cli/package.json | 2 +- src/ui-ux-pro-max/scripts/search.py | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cli/assets/scripts/search.py b/cli/assets/scripts/search.py index 0d8a951..3981cd2 100644 --- a/cli/assets/scripts/search.py +++ b/cli/assets/scripts/search.py @@ -15,9 +15,17 @@ Persistence (Master + Overrides pattern): """ import argparse +import sys +import io from core import CSV_CONFIG, AVAILABLE_STACKS, MAX_RESULTS, search, search_stack from design_system import generate_design_system, persist_design_system +# Force UTF-8 for stdout/stderr to handle emojis 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') + def format_output(result): """Format results for Claude consumption (token-optimized)""" diff --git a/cli/package.json b/cli/package.json index 8f7d4fb..7a8aca3 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "uipro-cli", - "version": "2.2.2", + "version": "2.2.3", "description": "CLI to install UI/UX Pro Max skill for AI coding assistants", "type": "module", "bin": { diff --git a/src/ui-ux-pro-max/scripts/search.py b/src/ui-ux-pro-max/scripts/search.py index 0d8a951..3981cd2 100644 --- a/src/ui-ux-pro-max/scripts/search.py +++ b/src/ui-ux-pro-max/scripts/search.py @@ -15,9 +15,17 @@ Persistence (Master + Overrides pattern): """ import argparse +import sys +import io from core import CSV_CONFIG, AVAILABLE_STACKS, MAX_RESULTS, search, search_stack from design_system import generate_design_system, persist_design_system +# Force UTF-8 for stdout/stderr to handle emojis 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') + def format_output(result): """Format results for Claude consumption (token-optimized)"""