Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal Express encoding fix for specials characters / umlaute


Tsimi

Recommended Posts

I was testing the PayPal Express payment module and encountered some issues when using German language address or names or product names with special characters in it.

These encoding issues have been fix by the community but they are spread around in multiple topics so I thought it might be helpful for others to have all fixes in one place.

 

PayPal Account Setting

 

Go to "My Account" -> "Profile" -> "My selling tools" -> "PayPal button language encoding"

 

Then setup

 

Your website's language:  Western European Languages (including English)

 

click the "more options" button and set Encoding to UTF-8.

Below where it says "Do you want to use the same encoding for data sent from PayPal to you (e.g., IPN, downloadable logs, emails)?"

tick the "Yes" checkbox.

Click "Save" and logout of your PayPal account.

 

Gergely added nice images that explain it visually how to do it.

 

http://www.oscommerce.com/forums/topic/397700-utf-8-in-payments-standard/?p=1702922

Encoding fix

This fix is by courtesy of @@raiwa he gave the key to the solution posted then later by @@HansTatt. Thanks guys! :thumbsup:

 

Inside the ext/modules/payment/paypal/express.php file look for this code

$item_params['L_PAYMENTREQUEST_0_NAME' . $line_item_no] = $product['name'];

and replace with

$item_params['L_PAYMENTREQUEST_0_NAME' . $line_item_no] = utf8_decode($product['name']);

then look for this code

	$params['PAYMENTREQUEST_0_SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
        $params['PAYMENTREQUEST_0_SHIPTOSTREET'] = $order->delivery['street_address'];
        $params['PAYMENTREQUEST_0_SHIPTOCITY'] = $order->delivery['city'];
        $params['PAYMENTREQUEST_0_SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
        $params['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
        $params['PAYMENTREQUEST_0_SHIPTOZIP'] = $order->delivery['postcode'];

and replace with this

	$params['PAYMENTREQUEST_0_SHIPTONAME'] = utf8_decode($order->delivery['firstname']) . ' ' . utf8_decode($order->delivery['lastname']);
        $params['PAYMENTREQUEST_0_SHIPTOSTREET'] = utf8_decode($order->delivery['street_address']);
        $params['PAYMENTREQUEST_0_SHIPTOCITY'] = utf8_decode($order->delivery['city']);
        $params['PAYMENTREQUEST_0_SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
        $params['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
        $params['PAYMENTREQUEST_0_SHIPTOZIP'] = $order->delivery['postcode'];

Reference Topic:

http://www.oscommerce.com/forums/topic/397165-paypal-standard-not-emptying-basket/?p=1714514

 

That's it.
 

Edited by Tsimi
Link to comment
Share on other sites

  • 1 year later...

Thank you.  But mine still got wrong encoding.
The Name and Address is unreadable like  this
------------------------------------------------------

???? ???????????
531 ?.????????
???????, 90110
Th, Thailand

And Paypal Express even add this address to the OSC database too.

 

Link to comment
Share on other sites

Hey, is this PayPal problem related to the more general problem with osC, of some servers handling "special characters" (e.g., "flower brackets"), and causing errors in osC shopping cart ?  I battled that problem for a long time and with forum help, posed a fix at forum thread "Can't Add Products to Shopping Cart"    with this excerpted explanation :

 

" The original problem stems from the way that my host  iPower.com -- and possibly others -- handle the "flower brackets" { }   (restricted for some "security" reason, they say).  These brackets are generated by osC code for URL's of products that are entered with attributes (in your shopping cart, hover over item titles and "REMOVE" button to see the URL's with brackets).  Apparently, other hosts don't create this "brackets" handling problem.

 

I'm struggling now to get PayPal v4.039 working (when trying PP Express, customer reports empty shopping cart at payment attempt) -- not sure if I should be using PP Express (osC v2.3.3 had worked fine) or Standard now...only need the simplest version to work.

Link to comment
Share on other sites

I can't get the PP standard to work.  The shopping cart is not empty after payment is done, none order was recorded in DB  and I didn't get confirmed e-mail.
Sill can't figure out how to fix it.

PP Express works fine, only Thai font issue is not.
So you should try PP Express.

Link to comment
Share on other sites

ironically, I uninstalled PP Express and install PP Standard module (these are v4.039).  In "configuration" I entered only the "PDT Identity Token" and "PayPal Public Certificate ID", both found under owner's account on the PP web site.  I left blank "Your Private Key" and "Public Certificate" (though I have one as a PEM file), "PayPal Public Certificate" and "Working Directory".   This works for my "live" test order (own credit card) and now just received a customer order. 

 

I'm a bit surprised with so much of the config info blank.  Not sure I understand the difference between PP Std & PP Exprs, and PP Exprs was certainly easire (at least more "sure" in configuring) to install.  But I'm hoping that I'm OK for the time being with the PP Std.

 

Did I mention that I could not get PP Express to work ?

Link to comment
Share on other sites

  • 3 years later...

Hi, Im desperated with Paypal and their simbols

I can give € 100 to someone for external advice to fix it. It took 2 months and there is no way to fix the strange characters and the clients complain. Paypal does not support us!.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...