Your last example of expected output is the exact output of
$ arr=( foo "quz bar" "wibble 'smoo' \"blep\"")$ printf "%q " "${arr[@]}"foo quz\ bar wibble\ \'smoo\'\ \"blep\"
The %q
placeholder in printf
outputs its string in quoted form, ready for use as input.