From cba3380b98ed66721285821126a233c8624b0421 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 11 Apr 2019 21:05:47 +0100 Subject: [PATCH] Fix mosquitto_sub encoding of special characters with %j format. Thanks to Ben Barbour. Closes #1220. --- ChangeLog.txt | 2 ++ client/sub_client_output.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 61245eaf..ca4d1c55 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -50,6 +50,8 @@ Client features: Client fixes: - mosquitto_pub wouldn't always publish all messages when using `-l` and QoS>0. This has been fixed. +- mosquitto_sub was incorrectly encoding special characters when using %j + output format. Closes #1220. 1.5.8 - 20190228 diff --git a/client/sub_client_output.c b/client/sub_client_output.c index fac4ce64..c4ff376a 100644 --- a/client/sub_client_output.c +++ b/client/sub_client_output.c @@ -101,7 +101,7 @@ static void write_json_payload(const char *payload, int payloadlen) for(i=0; i=0 && payload[i] < 32)){ - printf("\\u%04d", payload[i]); + printf("\\u%04x", payload[i]); }else{ fputc(payload[i], stdout); }