PayPal Data Encoding Mismatch Fix

Lately, I have been working on integrating PayPal with a shopping cart I have created as a mode of payment for a client’s website. For the not so fortunate ones like myself, I am sure along the way you have encountered the very common data encoding mismatch error.

What Error?

For those who I have already lost, does this message ring a bell?

Error: Data does not match input character set or default encoding

This occurs when you are trying to pass information to PayPal through your form with an encoding that it does not understand. As a general rule for most websites, an UTF-8 encoding would be the way to go.

How to Fix it

Assume you have already set your page encoding together with the database tables and columns as UTF (if you are retrieving the information dynamically), yet PayPal is still having that wee bit of difficulty in processing it.

To get around this, we have to tell PayPal what exactly is the data encoding type by adding a hidden input within your form.

<input name="charset" type="hidden" value="utf-8" />

That error message should almost instantly disappear now.

I hope this post has helped you, if you are still having problems, drop me a comment with a working URL and I will take a look.

Related Posts:

Your Say ...

  1. xiao jie says:

    you are a programming freak!

    • Darran says:

      This programming freak is doing a good deed by providing a fix to a problem which thousand many others may encounter.

Write ...