Jump to content
Tsimi

PayPal Express encoding fix for specials characters / umlaute

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://forums.oscommerce.com/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://forums.oscommerce.com/topic/397165-paypal-standard-not-emptying-basket/?p=1714514

 

That's it.
 

Edited by Tsimi

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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 ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×