+ Start a Discussion


Hi friends,


im trying to upload some leads using Java and the REST API feature, but after all day fighting against the Charset UTF-8 and ISO-8859-1 , i found out  that when you try to upload a UTF-8 encoded json object with a special character in the Company field, it responds you with a 400 - bad request.


You can have special characters enconded in UTF-8 in any other field as FirstName, LastName, Street, City, Country, etc. this works and the lead will be uploaded, but if you have it in Company it will crash.


Does any body knows why is this ? It seems as a bug, or is something i need to configure in the ORG ?


thanks for watching



Best Answer chosen by Solees
This was my Solution:

StringEntity body = new StringEntity(contact.toString(1), "UTF-8");

All Answers

Mohith Kumar ShrivastavaMohith Kumar Shrivastava

"LastName" : "Express Logistics and Transport",
"Company" :"@@@@@@@%%%"


Service URI:/services/data/v26.0/sobjects/Lead/


I used the above REST API and it works perfectly to upload lead .


Can you please post the Service URL you are trying

Please try tu encode something like "Mártinez Míramontes" and then upload it and tell me if it worked for you. Cheers -- Unleash your true potential Sent from my iPhone

We are seeing a smilar issue trying to save a User/Contact name that has accented characters like á, é etc.

We are using the REST Api to create/update Users/Contacts.

We set the charset to UTF-8 when doing httpPost or httpPatch such :


HttpPost httpPost = new HttpPost(host + url);
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
httpPost.setEntity(new StringEntity(jsonRequest, "UTF-8"));


We do not get an error, the objects are created/updated, but the accented characters appear funny when viewing in SF.


Please let us know if this is a known issue, or we are missing something ?



James GalindoJames Galindo
Hey Solees, did you ever figure out wht sfdc does not allow special characters through the restfull api even when byte encoing with UTF8? I have the same situation. Thanks!
This was my Solution:

StringEntity body = new StringEntity(contact.toString(1), "UTF-8");
This was selected as the best answer