Sunday, October 22, 2006

Paypal IPN with UTF8

Today, I got stuck a couple of hours on implementing Paypal IPN with UTF-8 encoding. You get loads of examples on the Web and in the documentation with windows-1252 default charset but none with UTF-8 encoding.

Documentation led me to the wrong track, trying to set the charset and form-charset post fields to UTF-8, but this does not work. You always get a windows-1252 encoded notification.

When you search for the solution on Google, you mostly get complaints from developers who struggle with it and pretend there are bugs.

Finally, the solution is obvious (as always). Log to the Paypal web site and go to your profile.
Click the Language Encoding link.


Click the More Options button.



Select UTF-8 in the Encoding drop down list. That’s all!

12 comments:

Anonymous said...

Thanks a bunch for that. I'm just getting to grips with making UTF-8 data work with existing IS0-8859 applications.

Loads of people seem to struggle with it... even big-name websites show themselves up with spurious  characters.

Stefan Andersson said...

Thanks a lot - this saved me from pulling my last remaining hairs out.

Anonymous said...

I love you.

Anonymous said...

Wonderful. Problem solved in 1 minute. Thanks to you ( and google ).

Andreas Paulsson said...

Thanks a lot.

I wonder why this is so badly hidden in Paypal settings. When You look at the page for "Language Encoding" You get the impression that this is only for Paypal buttons, but when You click the "More Options" button, You realize that these settings also affect IPN.

Steve said...

Thanks very much years after the fact... even today this saved me some valuable time. I kept looking at the charset=windows-1252 parameter suspiciously but when some transactions were successful and others were not I didn't think twice about that!

Time to bone up on encoding again.

David said...

You saved me some hours too. Very good. PayPal should really use the same encoding as in the first call.

Alan Kelm said...

Thanks for the tip about setting the Language Encoding within PayPal. It is worth noting that this setting does not (in my experience) affect the PayPal Sandbox, which uses Windows-1252 encoding for its IPN notifications. It is therefore prudent to adjust one's software to used Windows-1252 encoding when responding to IPN's with 'test_ipn' set to 1.

Михаил said...

Respect to you, man. Thanks a lot!

Benoît Bouré said...

Great!! I have been scratching my head with this!!
That works!!!
thanks!

Diseño Web Barcelona

Dennis Robins said...

Thanks you post is helpful. PayPal moved the setting it's now...

Profile > More options > My selling tools > PayPal button language encoding

We'll see how long that path stays :)

Alex said...

This option seems not to be available anymore. So you have to call https://www.paypal.com/ie/cgi-bin/webscr?cmd=_profile-language-encoding after login to PayPal and choose "More options".