Special characters within a GraphQL query in shell script

Viewed 255

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.

0 Answers
Related