Accent Marks/Special Characters in Python Request

  • 4 June 2021
  • 1 reply

Userlevel 1



I’m using CODE by Zapier tu run a POST request in order to save contacts to my CRM platform.

The problem is that some contacts names or last names have special characters such as accent marks (á, é, í, ó, ú) or the letter “ñ”

I’m using Python Request to send the POST Request and adding the value to the JSON as shown below:


import http.client

conn = http.client.HTTPSConnection("")
payload = "{\r\n \"ProfileKey\":\"[SECRET KEY]\", \r\n\"Contact\":\r\n{\"Email\":\""+input_data['email']+"\",\r\n \"CustomFields\":[\r\n{\"Key\":\"d_first_name\",\"Value\":\""+input_data['nombre']+"\"},\r\n{\"Key\":\"d_last_name\",\"Value\":\"Neiva\"},\r\n{\"Key\":\"d_celular\",\"Value\":\"Neiva\"},\r\n{\"Key\":\"q88696_ltbgtconoces_y_aceptas_la_poli\",\"Value\":\"Neiva\"}\r\n ]\r\n}\r\n}\r\n"
headers = {
'Authorization': '[SECRET KEY]',
'Content-Type': 'application/json',
'Cookie': 'ASP.NET_SessionId=4sbyadeh0bgrlimefr2abzpk'
conn.request("POST", "/Contacts/SaveContact.Json/", payload, headers)
res = conn.getresponse()
data =

Everytime the action faces a special character or a “ñ” it generates error code. The example above returns error since the input field number is equal to “Lucás”, with the accent mark on the “a” letter.

Is there a way to include the variables in the JSON ignoring these special characters?


Thanks in advance



1 reply

Userlevel 2
Badge +1

Hey @LucasIcomm

Have you looked at the Formatter by Zapier/Convert to ASCII function? 

Otherwise, the best place to ask for help with your code is Just tag your question with a “Zapier” tag and usually there will be folks who are willing to help you out. You can see all the questions that have already been asked here:

If you haven’t already, definitely read through our documentation to make sure your code is following our guidelines and all your inputs and outputs are set correctly - though it sounds like you have a handle on that already 😀

Additional Resources:


Hope this helps!