I get the following error when I try to synch up any value containing an ampersand or a unicode character:
Salesforce Error: SoapFault The entity name must immediately follow the '&' in the entity reference.

How have other folks dealt with this?

Comments

aaronbauman’s picture

Status: Active » Needs work
StatusFileSize
new1.1 KB

This patch runs values through htmlentities during salesforce_api_fieldmap_export_create, so that special html characters are encoded before SOAP gets its hands on the sobject.

I have used this patch with some success, but I don't think it's a complete solution to this issue.

aaronbauman’s picture

Status: Needs work » Postponed (maintainer needs more info)

committed http://drupal.org/cvs?commit=330970

I still suspect that this patch is insufficient, but I don't have any actual cases.
Please report any specific failures in this issue and re-activate.

kostajh’s picture

Status: Postponed (maintainer needs more info) » Active

According to Salesforce docs, these are reserved characters (for searches anyway):

? & | ! { } [ ] ( ) ^ ~ * : \ " ' + -

The docs specify that a backslash needs to go before each reserved character. How do you all feel about doing that instead of running export fields through htmlentities?

kostajh’s picture

Title: unicode characters and html entities » Escape reserved characters when exporting data to Salesforce
Status: Active » Needs review
StatusFileSize
new2.24 KB

Here is a patch for testing. I have not had a chance to test it out myself yet.

kostajh’s picture

Status: Needs review » Needs work

So, this works to some extent. Instead of seeing '& amp;' for an "&", I now see "\&". The problem is that the backslash shouldn't be in SF, because the next time I run an import for that user, I'll then have "\\\&" in Drupal. Does anyone have ideas on this? I've been searching through the Salesforce forums and found other people asking about the issue, but no answers.

kostajh’s picture

Status: Needs work » Needs review
StatusFileSize
new1.66 KB

Ok, buried in the Salesforce developer docs is a little note that says the encoded data is usually handled for you by the SOAP client. Sure enough, if we remove the calls to htmlentities(), the SOAP client handles the encoding for us just fine. I tested all the reserved characters from #3 without any issues. I suspect in Nov '09 when this issue was filed, the SOAP client did not handle the encoding.

Attached patch removes use of htmlentities().

kostajh’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.