From 2e821b9f628ba53e03248d33ae4e45fd1d31421f Mon Sep 17 00:00:00 2001 From: Dirk Date: Sun, 3 Oct 2021 18:31:06 +0200 Subject: [PATCH] Fix invalid JSON when certificate issuer contains non-ASCII chars (3.0) Changed printf %s to printf %b which cause now to output UTF-8 correctly. See #1992. --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index c04d055..ae83f70 100755 --- a/testssl.sh +++ b/testssl.sh @@ -802,7 +802,7 @@ fileout_json_print_parameter() { spaces=" " || \ spaces=" " if [[ -n "$value" ]] || [[ "$parameter" == finding ]]; then - printf "%s%s%s%s" "$spaces" "\"$parameter\"" "$filler" ": \"$value\"" >> "$JSONFILE" + printf -- "%b%b%b%b" "$spaces" "\"$parameter\"" "$filler" ": \"$value\"" >> "$JSONFILE" "$not_last" && printf ",\n" >> "$JSONFILE" fi }