Plugin: @dsh-external/dsh-vision-toolkit v0.1.2 (local link install)
OS: Windows 11 (zh-CN) | Node: 24.13.0 | Python: 3.13.12 (managed runtime, uv)
Repro
Call vision_extract_foreground on any image (tested on a 1628x896 PNG screenshot, auto and color modes).
Error: extract_foreground: unexpected output: bbox (ԭͼ����): x1: 22, y1: 850, x2: 49, y2: 877 | ǰ������: 593 ... ������ռ��: 48%
(the Chinese in the error is mojibake)
Root cause
The pinned skills/vision-tools/scripts/extract_fg.py prints Chinese diagnostics:
print(f"bbox (原图像素): x1: {bx1}, y1: {by1}, x2: {bx2}, y2: {by2}")
print(f"前景像素: {len(best)} 保留分量: {len(kept)}/{len(comps)} 最大分量占比: ...%")
print(f"wrote {dest} ({out.width}x{out.height})")
On Windows, Python encodes pipe stdout with the ANSI code page (cp936 on zh-CN) because the plugin's subprocess env in lib/upstream.js run() does not set PYTHONIOENCODING/PYTHONUTF8/LANG. The plugin parses stdout as UTF-8 (lib/upstream.js parseExtractForegroundOutput, regexes like /^bbox \(原图像素\):/), so no line ever matches and the call fails with unexpected output. I verified by running the vendored script directly — its stdout is GBK and shows as mojibake when interpreted as UTF-8.
The error message itself is also hard to read because the raw misdecoded bytes are embedded in it.
Suggested fix
Set PYTHONIOENCODING=utf-8 (or PYTHONUTF8=1) in the plugin subprocess env for local upstream tools, and/or have the upstream scripts reconfigure stdout (sys.stdout.reconfigure(encoding='utf-8')). Consider making the error path decode-safe.
Plugin: @dsh-external/dsh-vision-toolkit v0.1.2 (local link install)
OS: Windows 11 (zh-CN) | Node: 24.13.0 | Python: 3.13.12 (managed runtime, uv)
Repro
Call
vision_extract_foregroundon any image (tested on a 1628x896 PNG screenshot, auto and color modes).(the Chinese in the error is mojibake)
Root cause
The pinned
skills/vision-tools/scripts/extract_fg.pyprints Chinese diagnostics:On Windows, Python encodes pipe stdout with the ANSI code page (cp936 on zh-CN) because the plugin's subprocess env in
lib/upstream.jsrun()does not setPYTHONIOENCODING/PYTHONUTF8/LANG. The plugin parses stdout as UTF-8 (lib/upstream.jsparseExtractForegroundOutput, regexes like/^bbox \(原图像素\):/), so no line ever matches and the call fails withunexpected output. I verified by running the vendored script directly — its stdout is GBK and shows as mojibake when interpreted as UTF-8.The error message itself is also hard to read because the raw misdecoded bytes are embedded in it.
Suggested fix
Set
PYTHONIOENCODING=utf-8(orPYTHONUTF8=1) in the plugin subprocess env for local upstream tools, and/or have the upstream scripts reconfigure stdout (sys.stdout.reconfigure(encoding='utf-8')). Consider making the error path decode-safe.