i have a problem with this paypal IPN. I saw, a lot of people had.
I try to pay as a user: Árvíztűrő Tükörfúrógép In this name, there are all special chars, what are in hungarian ABC.
I am a hungarian PHP developer.
Ok, i tried to search a lot of on google. The first thing was to check the paypal language settings: http://jlchereau.blogspot.hu/2006/10/paypal-ipn-with-utf8.html
Every settings are UTF-8.
When paypal called my notify url, i (previous developer) build the request URL. When i logged this url, i saw, the charset was not UTF-8, so i force the script to use that.
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
if ($key == 'charset') {
$req .= "&charset=utf-8";
} else {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
}
And here is the intresting thing. I get back a totally mallformed username. So i dump it char by char.
The first name will be: CHARS: 193, 114, 118, 237, 122, 116, 26, 114, 26
Suck. I tried to everything to get my real utf-8 name The mb_detect_encoding is UTF-8 for it.
I tried to use iconv, mb_convert_encoding, utf8_encode and decode. No success. Tried to not urlencode the name, no success again.
Can somebody tell me, why is it, and how can i get back the real utf8 name?
The URL what i sent: cmd=_notify-validate&mc_gross=10.00&protection_eligibility=Eligible&address_status=confirmed&payer_id=JA3YMCJFKSCNJ&tax=0.00&address_street=1+Main+St&payment_date=07%3A41%3A40+Sep+05%2C+2012+PDT&payment_status=Completed*&charset=utf-8*&address_zip=95131&first_name=%C1rv%EDzt%1Ar%1A&mc_fee=0.59&address_country_code=US&address_name=%C1rv%EDzt%1Ar%1A+T%FCk%F6rf%FAr%F3g%E9p¬ify_version=3.6&custom=lolka_bolka%3Bfalse%3B%3B%3B%3BHungary%3B%3B%3B%3B%3B%3B&payer_status=verified&business=vaso_1346830963_biz%40mydomain.hu&address_country=United+States&address_city=San+Jose&quantity=1&verify_sign=AVVJjJNeVwHbYcMDVfj2N1DqWwUdAtNQIpb9KIP99gZ2PY-LPoOYzSCc&payer_email=test_1346830232_per%40mydomain.hu&txn_id=4J747779YW528551F&payment_type=instant&last_name=T%FCk%F6rf%FAr%F3g%E9p&address_state=CA&receiver_email=vaso_1346830963_biz%40mydomain.hu&payment_fee=0.59&receiver_id=TGEHBCMG336WE&txn_type=web_accept&item_name=510+Silk&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=lolka_bolka%3Bfalse%3B%3B%3B%3BHungary%3B%3B%3B%3B%3B%3B&payment_gross=10.00&shipping=0.00&ipn_track_id=6fe12a7a34b74
You should change your settings at Paypal.
Lenart's answer is great and very useful, but I thought I'd add a few things that wouldn't fit in a comment.
charset
on your site, in your order form (e.g.: via a hidden input), is NOT enough, you also need to set your default encoding – as explained in Lenart's answer.
UTF-8
as a hidden input on your order form but PayPal IPNs still are in windows-1252
. You can only fix that by changing the default setting in your PayPal account.charset
in the POST message.Western European Languages (including English)
would cause French accented characters not to work.UTF-8
in the IPNs.)§
EDIT. Last but not least:
If you'd like to test your IPN-handling script with special or accented characters, you have (theoretically) a few different options but most do not work in practice.
Here's a recap:
Only enter letters
(sic).Something went wrong. One or more sandbox accounts could not be uploaded. Try again.
I reported this issue to PayPal months ago but nothing has changed.
§
Working with PayPal is no fun and a big waste of time. I hope this will help you save some time. Take your business elsewhere if you can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With