• deb_butan
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi Guys,

I use WWW::Salesforce to create accounts, contacts and opportunities in salesforce. It all works nicely until I try to send customer names that use special characters other than ascii.

 

These when viewed in salesforce look as if the encoding is broken. AFAIK SOAP::Lite which WWW::Salesforce uses is utf8 per default (I tried setting it manually, no success).

 

Interstingly, when I use Encode::encode_utf8 on the strings I pass on to the hash (see below) Dumper prints the strings properly (and no, it does not work without that call as well). So I'm thinking, I got the strings properly utf8-ed. Still, no success on the salesforce side. Could it be that SOAP::Lite re-encodes them again although they are utf8? (if I leave them unencoded, the string that arrives is a different one but still broken). Here are the details:

 

Sent string (contact name): 2äöäöääö

 

Arrived string: 2äöäöääö

 

Dumper output:

$VAR1 = {
          'Phone' => undef,
          'MailingCountry' => undef,
          'FirstName' => '1lölölööl',
          'Login__c' => 'eetestu14',
          'LastName' => '2äöäöääö',
          'MailingStreet' => undef,
          'Email' => 'XXXXXXXXX'
          'type' => 'contact',
          'AccountId' => 'XXXXXXXX',

};

 

Perl code:

use Encode;

my $contact =
  {

    'type'=> 'contact',

    'AccountId' => $accountId,   

    'FirstName' => encode_utf8($user->getFirstName()),
    'LastName' => encode_utf8($user->getLastName()),
    'Login__c' => $user->getLogin(),
    'Email' => $user->getEmail(),
    'Phone' => $user->getContactPhone(),
    'MailingStreet' => $user->getContactAddress1(),
    'MailingCountry' => $user->getContactCountry(),
  };
 $res = $self->sf()->create(%$contact);

 

So, any ideas what I might be doing wrong?

 

Cheers,

Emil