hikctl crashes with UnicodeEncodeError on cp1252 stdout after completing the action #181
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral#181
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Over non-interactive SSH, or whenever stdout is redirected, Python on Windows falls back to the
cp1252console encoding. Thehikctlconsole helpers print characters outside cp1252 (✓,✗, box-drawing╔═╗) inapp/cli/common/console.py(header,success,error). As a result, every command crashes withUnicodeEncodeError: 'charmap' codec can't encode character '✓'.The crash comes after the action has already run. On 2026-09-28,
user add visualData --role viewer --password ...created the user and wroteUSER_CREATEtolifecycle.log, then printed three chained tracebacks. An operator would reasonably think the command failed and retry it.user listfails outright.hikctl.cmddoesn't set an encoding either, so it is affected the same way.Expected
CLI output never raises because of the terminal encoding. Two possible fixes: call
sys.stdout.reconfigure(errors="replace")or switch to UTF-8 at CLI entry, or have the console fall back to ASCII glyphs ([OK],[X],+--+). SettingPYTHONIOENCODING=utf-8works around it for now.