fix: preserve UTF-8 in generated command docs

Transcode the MinGW client's CP850 output before writing command documentation and force Python to read the converted stream as UTF-8. Normalize the remaining escaped Greek mu strings to the project's micro sign convention.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
This commit is contained in:
歐歪andOpenAI Codex committed 2026-09-22 05:37:09 +08:00
1 parent 6150d8fc57
commit 6775a78a10
2 files changed
+12 -6

No files matched your search

+9 -2
View File
@@ -354,13 +354,20 @@ style: commands
--style=google --unpad-paren --pad-header \
--align-pointer=name {} \;
COMMANDS_UTF8_FILTER := cat
COMMANDS_PYTHON := python3
ifdef IS_MINGW
COMMANDS_UTF8_FILTER := iconv -f CP850 -t UTF-8
COMMANDS_PYTHON := PYTHONIOENCODING=utf-8 python3
endif
commands: client
# Update commands.md
[ -x client/proxmark3 ] && client/proxmark3 -m | tr -d '\r' > doc/commands.md
[ -x client/proxmark3 ] && client/proxmark3 -m | $(COMMANDS_UTF8_FILTER) | tr -d '\r' > doc/commands.md
# Make sure python3 is installed
@command -v python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 )
# Update commands.json, patch port in case it was run under Windows
[ -x client/proxmark3 ] && client/proxmark3 --fulltext | sed 's#com[0-9]#/dev/ttyACM0#'|python3 client/pyscripts/pm3_help2json.py - - | tr -d '\r' > doc/commands.json
[ -x client/proxmark3 ] && client/proxmark3 --fulltext | $(COMMANDS_UTF8_FILTER) | sed 's#com[0-9]#/dev/ttyACM0#'|$(COMMANDS_PYTHON) client/pyscripts/pm3_help2json.py - - | tr -d '\r' > doc/commands.json
# Detecting weird codepages and tabs.