fix: Windows 控制台 emoji 编码崩溃
Windows 默认控制台编码是 cp936(中文)或 cp1252(西文), print() 输出 emoji 字符时直接 UnicodeEncodeError 崩溃。 在 cli.py 入口处添加 UTF-8 encoding wrapper, 用 errors='replace' 确保不会因为编码问题导致整个程序崩溃。
This commit is contained in:
@@ -19,6 +19,14 @@ import argparse
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# Fix Windows console encoding — emoji/CJK characters crash on cp936/cp1252
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
import io
|
||||||
|
if hasattr(sys.stdout, 'buffer'):
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
||||||
|
if hasattr(sys.stderr, 'buffer'):
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
|
||||||
|
|
||||||
from agent_reach import __version__
|
from agent_reach import __version__
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"exa": {
|
||||||
|
"baseUrl": "https://mcp.exa.ai/mcp"
|
||||||
|
},
|
||||||
|
"xiaohongshu": {
|
||||||
|
"baseUrl": "http://localhost:18060/mcp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user