Paypal IPN 覆盖字符集

我对此贝宝 IPN 有问题.我看到了,很多人都有.

i have a problem with this paypal IPN. I saw, a lot of people had.

我尝试以用户身份付款:Árvíztűrő Tükörfúrógép在这个名称中,所有特殊字符都是匈牙利语 ABC 中的内容.

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.

我是一名匈牙利 PHP 开发人员.

I am a hungarian PHP developer.

好的,我试着在谷歌上搜索了很多.第一件事是检查贝宝语言设置:http://jlchereau.blogspot.hu/2006/10/paypal-ipn-with-utf8.html

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

每个设置都是 UTF-8.

Every settings are UTF-8.

当 paypal 调用我的通知 url 时,我(以前的开发人员)构建了请求 URL.当我记录这个 url 时,我看到字符集不是 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.

名字将是:字符:193、114、118、237、122、116、26、114、26

The first name will be: CHARS: 193, 114, 118, 237, 122, 116, 26, 114, 26

吸.我想尽一切办法得到我真正的 utf-8 名称mb_detect_encoding 是 UTF-8.

Suck. I tried to everything to get my real utf-8 name The mb_detect_encoding is UTF-8 for it.

我尝试使用 iconv、mb_convert_encoding、utf8_encode 和解码.没有成功.尝试不对名称进行 urlencode,再次失败.

I tried to use iconv, mb_convert_encoding, utf8_encode and decode. No success. Tried to not urlencode the name, no success again.

谁能告诉我,为什么会这样,我怎样才能找回真正的 utf8 名称?

Can somebody tell me, why is it, and how can i get back the real utf8 name?

我发送的网址: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_eligibility=Eligible&address_status=确认2012+PDT&payment_status=完成*&charset=utf-8*&address_zip=95131&first_name=%C1rv%EDzt%1Ar%1A&mc_fee=0.59&address_country_address_name=US&=%C1rv%EDzt%1Ar%1A+T%FCk%F6rf%FAr%F3g%E9p&notify_version=3.6&custom=lolka_bolka%3Bfalse%3B%3B%3B%3BHungary%3B%3B%3B%3B%3B%3B和放大器; payer_status =验证的&放大器;商业= vaso_1346830963_biz%40mydomain.hu和放大器; ADDRESS_COUNTRY =美+美国和放大器; ADDRESS_CITY =圣+何塞&放大器;数量= 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&transactionka_subject%3Bol3Bol3Bol%3B%3B%3B%3B%3B&payment_gross=10.00&shipping=0.00&ipn_track_id=6fe12a7a34b74

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&notify_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

推荐答案

您应该在 Paypal 上更改设置.

You should change your settings at Paypal.

  • 转到您的 Paypal 个人资料
  • 点击侧边栏中的我的销售工具
  • 滚动到底部并点击PayPal按钮语言编码
  • 点击更多选项并将编码设置为 UTF-8
  • go to your Paypal profile
  • click My selling tools in the sidebar
  • scroll to the bottom and click PayPal button language encoding
  • click More options and set the encoding to UTF-8

相关文章