The entity “Atilde” was referenced, but not declared.

While using SalesForce API to upsert data to SalesForce I’ve got an error “The entity “Atilde” was referenced, but not declared.”. I found out that the problem causing this error was htmlentities php function. htmlentities converts all applicable characters to HTML entities. html_entity_decode php function solved the problem so don’t use htmlentities, try to change this function with htmlspecialchars if you want to sanitize html for salesforce.