Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal express encoding issue (Umlauts and spcial characters)


guntersammet

Recommended Posts

Hi all:

Just a little hint in case any of you stumbles over this:

 

The paypal express module takes the shipping and billing address from PayPal. This caused us to have encoding issues for any special character. Especially in French, Spanish and German. Here a quick and "dirty" fix:

 

ext/modules/payment/paypal/express.php

Line 107 till 120 ($Id: express.php 1803 2008-01-11 18:16:37Z hpdl $), change to:

 

         $sendto = array('firstname' => may_decode(substr($response_array['SHIPTONAME'], 0, strpos($response_array['SHIPTONAME'], ' '))),
                         'lastname' => may_decode(substr($response_array['SHIPTONAME'], strpos($response_array['SHIPTONAME'], ' ')+1)),
                         'company' => '',
                         'street_address' => may_decode($response_array['SHIPTOSTREET']),
                         'suburb' => '',
                         'postcode' => $response_array['SHIPTOZIP'],
                         'city' => may_decode($response_array['SHIPTOCITY']),
                         'zone_id' => $zone_id,
                         'zone_name' => may_decode($zone_name),
                         'country_id' => $country['countries_id'],
                         'country_name' => $country['countries_name'],
                         'country_iso_code_2' => $country['countries_iso_code_2'],
                         'country_iso_code_3' => $country['countries_iso_code_3'],
                         'address_format_id' => ($country['address_format_id'] > 0 ? $country['address_format_id'] : '1'));

 

At the end of the file add:


 function may_decode($to_decode_string){
   $decoded_string = $to_decode_string;
   if(CHARSET == 'iso-8859-1'){
     $decoded_string = utf8_decode($to_decode_string);
   }
   return $decoded_string;
 }

 

before the "?>".

 

Since PayPal sends the data in UTF8, you need to decode it. If you have languages with different encoding (defined in the language file), you need to amend the may_decode function.

HTH

 

Gunter

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...