From 6775a78a10532ccdbff15591b02b2a839c8d0043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=90=E6=AD=AA?= Date: Tue, 22 Sep 2026 05:37:09 +0800 Subject: [PATCH 1/2] 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 --- Makefile | 11 +++++++++-- client/src/cmdlfhitag.c | 7 +++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 556ee5341..3ef4f1ab4 100644 --- a/Makefile +++ b/Makefile @@ -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. diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index 8772c8742..c7aa90f08 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -1940,7 +1940,7 @@ static int CmdLFHitagEload(const char *Cmd) { arg_lit0("1", "ht1", "Card type Hitag 1"), arg_lit0("2", "ht2", "Card type Hitag 2"), arg_lit0("s", "hts", "Card type Hitag S"), - arg_lit0("m", "htm", "Card type Hitag \xce\xbc"), // μ + arg_lit0("m", "htm", "Card type Hitag µ"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -1990,7 +1990,7 @@ static int CmdLFHitagEload(const char *Cmd) { } else if (use_htm) { // a u dump is sized by the tag's ICR, so accept anything that fits expected = 0; - tname = "Hitag \xce\xbc"; + tname = "Hitag µ"; } if (use_htm) { @@ -2053,7 +2053,7 @@ static int CmdLFHitagEview(const char *Cmd) { arg_lit0("1", "ht1", "Card type Hitag 1"), arg_lit0("2", "ht2", "Card type Hitag 2 (default)"), arg_lit0("s", "hts", "Card type Hitag S"), - arg_lit0("m", "htm", "Card type Hitag \xce\xbc"), + arg_lit0("m", "htm", "Card type Hitag µ"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -2933,4 +2933,3 @@ int CmdLFHitag(const char *Cmd) { return CmdsParse(CommandTable, Cmd); } - From 940f26ce373a004207dcb9131c29ac7c5a616fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=90=E6=AD=AA?= Date: Tue, 22 Sep 2026 07:24:43 +0800 Subject: [PATCH 2/2] build: centralize Python executable definition Co-Authored-By: OpenAI Codex --- Makefile | 6 +++--- Makefile.defs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3ef4f1ab4..b5536fad4 100644 --- a/Makefile +++ b/Makefile @@ -355,17 +355,17 @@ style: commands --align-pointer=name {} \; COMMANDS_UTF8_FILTER := cat -COMMANDS_PYTHON := python3 +COMMANDS_PYTHON := $(PYTHON3) ifdef IS_MINGW COMMANDS_UTF8_FILTER := iconv -f CP850 -t UTF-8 - COMMANDS_PYTHON := PYTHONIOENCODING=utf-8 python3 + COMMANDS_PYTHON := PYTHONIOENCODING=utf-8 $(PYTHON3) endif commands: client # Update 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 ) + @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 | $(COMMANDS_UTF8_FILTER) | sed 's#com[0-9]#/dev/ttyACM0#'|$(COMMANDS_PYTHON) client/pyscripts/pm3_help2json.py - - | tr -d '\r' > doc/commands.json diff --git a/Makefile.defs b/Makefile.defs index 8cfcce10e..7304bb5f6 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -53,6 +53,7 @@ USERMOD = usermod -aG ADDUSER = adduser GETENT_BL = getent group bluetooth +PYTHON3 ?= python3 PYTHON3_PKGCONFIG ?= python3 PATHSEP=/