I'm using the GraphQL API from Pimcore to create Customers Objects within a simple shell script.
Everything works fine except when names or lastnames are with special characters (in spanish) like:
á, é, í, ó, ú, ?
This is the code I'm using
#!/usr/bin/env sh
OLDIFS=$IFS
IFS=";"
while read -r f1 f2 f3
do
curl -H "Content-Type: application/json" -d '{ "query": "mutation { createCustomer( key:"'${f1}'", parentId:703, input:{ firstname:"'${f2}'", lastname:"'${f3}'"} ) { success message }}"}' http://localhost/pimcore-graphql-webservices/shop?apikey=295b86489dca91a4aafaac8315cdb84a --insecure
done < CUSTOMERS.csv
IFS=$OLDIFS
Is there any way to escape those? Or maybe a better way to do it?
I've tried a lot of possibilities but couldn't make it work.
Any help is appreciated.
question from:
https://stackoverflow.com/questions/65947534/special-characters-within-a-graphql-query-in-shell-script 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…