function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dhruvadhruva 

Salesforce.pm and internationalization

Hi,
Yes, that fun internationalization topic again. I'm struggling with this one.

Some background: perl script using query method from Salesforce.pm.

The query: select Id from Contact where (Email='junk@junk.com' or (FirstName='test' and LastName='Pérez'))

That last name seems to be the trouble. I get back the following fault string:
MALFORMED_QUERY: malformed query: unexpected token: (followed by what seems to be the sessionID).

And yes, I am doing:
my $last_name = Encode::encode_utf8($_[2]);
($_[2] is the last name)

If I don't use encode_utf8, I get the following Perl error:
Wide character in subroutine entry at [perl directory]/SOAP/Lite.pm line 129, which is the base64 subroutine. Poked around the web and found this:
http://cookbook.soaplite.com/#internationalization%20and%20encoding
but that didn't really seem to help. At least, I couldn't figure out how to make it help.

Any ideas? Not sure about this one, but it seems to only happen on the query. I know I have sent utf-8 characters to the update method.
dhruvadhruva
FYI: the answer was in the link
http://cookbook.soaplite.com/#internationalization%20and%20encoding

after all. I now pass the query string through SOAP:ata before passing it to Salesforce.pm. Something like:
$query_str = SOAP:ata->type(string => $call_parameter);
my $result = $port->query('query' => $query_str,
'limit' => 1000);

where $call_parameter is my query string (e.g. "select Id from Contact where Email='junk@junk.com'", etc.). Not exactly sure why it didn't work the first time.

Curiously, I do not have to do this pre-processing for create calls.