Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Special characters


fredrik@nordwall.se

Recommended Posts

Hello

 

I have upgrades my shop to 2.3.3.4. I have a paymentmodule from the paymentpartner

"Klarna" in Sweden. They are using ISO-8859-1.

My understanding is that the new Osc release using UTF8.

I convert the data to iso-8859-1 but the paymentpartner says that I sending in UTF8.

 

In checkout_process.php right after creating new instance of the Órder object

I convert to iso-8859-1 like this

 

require(DIR_WS_CLASSES . 'order.php');
$order = new order;
$order->delivery['street_address'] = mb_convert_encoding($order->delivery['street_address'], "ISO-8859-1", "UTF-8");

 

I don't understand what the problem is.

Are there any body from Sweden that have had this problem?

 

Regards

Fredrik

 

Link to comment
Share on other sites

If you're using the code you gave in your post, you're converting an empty order address field. That will accomplish nothing. You need to have actual data in the string ('street_address' array element) to do any good. Also, is there anything else you're sending to the payment partner that might still be in UTF-8 encoding? Customer name, city name, province name, etc.?

 

I'm surprised that in this day and age, your payment partner doesn't have a way of accepting UTF-8 encoded data (and possibly other encodings). I would ask them if there is any configuration setting to permit you to send UTF-8 encoded data. More and more websites are going to be dealing in UTF-8, as it permits a very wide range of characters, far more than any single-byte encoding.

Link to comment
Share on other sites

Hi

 

Thanks for your answer.

There is data in 'street_address'. The code I posted is not all code in the php file.

I have the original checkout_process.php file from OsCommerce. Then I added this line:

    $order->delivery['street_address'] = mb_convert_encoding($order->delivery['street_address'], "ISO-8859-1", "UTF-8");

 

I also convert the other fields in the delivery Array like firstname, lastname, postcode and city.

 

During the checkout process in the shop I get the delivery_address from my payment partner.

They sending the address in ISO-8859-1. This is done in the checkout_confirmation.php.

Then I trying to display the address in the shop the address is not visible.

But when I convert it to UTF8 the address is visible.

In the last step in the checkout process when´the order is approved of the customer I send the order

to the payment partner in the checkout_process.php file. In this file I convert the address to ISO-88-59-1.

 

I also wondering why the payment partner doesn't accept UTF8. It is year 2015!

Link to comment
Share on other sites

OK, so $order->delivery['street_address'] has some UTF-8 address text in it, and you call mb_convert_encoding() sometime after (and before calling your payment partner)? Two things I'd check:

  1. Print out the converted text just before the call to the payment partner, and see if the conversion really did work. If your site is UTF-8, you should see accented characters displayed as "invalid character" (?-in-black-diamond).
  2. Double check that you uploaded the file you modified to the right place. I don't know how many times I've seen people forget to upload, or upload to the wrong place, or the upload failed (permissions, etc.) and complain that the code doesn't work.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...