If I attempt to base64 encode a font file and output the contents to a text file like so:
base64 myfont.woff2 > output.txt
It works great given that the font is stored locally. However if I try to curl the font from a web url and base64 the output it results in a bunch of gibberish being saved to the file, for example:
#!/bin/bash
declare -a arr=(
"https://fonts.gstatic.com/s/opensans/v14/K88pR3goAWT7BTt32Z01mxJtnKITppOI_IvcXXDNrsc.woff2"
)
for i in "${arr[@]}"
do
content="$(curl -s "$i")"
echo base64 "$content" > output.txt
done
How to get this to work?