> On 16 Feb 2022, at 1:20 pm, Wietse Venema <[email protected]> wrote:
>
>> Actually, no, with "-r" not only are quotes removed, but also escaped
>> forms are converted back to the underlying UTF-8 form, and control
>> characters are output verbatim (as newlines, ESC, ...).
>
> Oops, I did an incorrect experiment.
>
> Confirming that -r produces unescaped output:
>
> $ cat x
> { "foo": "\nbar"}
> $ jq -r .foo x|od -cb
> 0000000 \n b a r \n
> 012 142 141 162 012
>
> So, "jq -r" expands \n into newline. What is the legitimate need
> to pass such things into scripts that expect newline-delimited output?
Well, if a message contains non-printable characters in the sender,
one of the recipient addresses, or delay reason, and I process the
output of "postqueue -j" in a language that supports JSON ("jq",
"python", "perl", ...) then it should be possible to see the actual
data without sanitisation.
--
Viktor.