From 3288c35c2a5bd1350e2ba34fa6935d009ba22a5d Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 21 Oct 2026 17:52:08 +0800 Subject: [PATCH] _json_encode/_json_decode: use printf instead of echo dash's echo interprets backslash escapes, so the \. MarkdownV2 escapes built by notify/telegram.sh collapsed to \. in the JSON body and Telegram rejected the message with "Character '.' is reserved". bash's echo does not, which is why only dash-based systems were hit. Fixes #7212 --- acme.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/acme.sh b/acme.sh index e1a35075..1505d1b3 100755 --- a/acme.sh +++ b/acme.sh @@ -907,7 +907,9 @@ _json_encode() { _j_str="$(sed 's/"/\\"/g' | sed "s/\r/\\r/g")" _debug3 "_json_encode" _debug3 "_j_str" "$_j_str" - echo "$_j_str" | _hex_dump | _lower_case | sed 's/0a/5c 6e/g' | tr -d ' ' | _h2b | tr -d "\r\n" + #printf, not echo: dash's echo interprets backslash escapes and would + #collapse the \\ sequences (e.g. Telegram MarkdownV2 escapes, issue 7212) + printf "%s\n" "$_j_str" | _hex_dump | _lower_case | sed 's/0a/5c 6e/g' | tr -d ' ' | _h2b | tr -d "\r\n" } #from: http:\/\/ to http:// @@ -915,7 +917,7 @@ _json_decode() { _j_str="$(sed 's#\\/#/#g')" _debug3 "_json_decode" _debug3 "_j_str" "$_j_str" - echo "$_j_str" + printf "%s\n" "$_j_str" } #extract the authorization URLs from an order response on stdin, as a