Escape double quotes and newlines when building config to send to curl.