title: Paypal IPN override charset
body: <p>i have a problem with this paypal IPN.
  I saw, a lot of people had.</p>
  
  <p>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.</p>
  
  <p>I am a hungarian PHP developer.</p>
  
  <p>Ok, i tried to search a lot of on google.
  The first thing was to check the paypal language settings:
  <a href="http://jlchereau.blogspot.hu/2006/10/paypal-ipn-with-utf8.html">http://jlchereau.blogspot.hu/2006/10/paypal-ipn-with-utf8.html</a></p>
  
  <p>Every settings are UTF-8.</p>
  
  <p>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.</p>
  
  <pre><code>$req = 'cmd=_notify-validate';
  foreach ($_POST as $key =&gt; $value) {
     if ($key == 'charset') {
        $req .= "&amp;charset=utf-8";
     } else {
        $value = urlencode(stripslashes($value));
        $req .= "&amp;$key=$value";
     }
  </code></pre>
  
  <p>}</p>
  
  <p>And here is the intresting thing. I get back a totally mallformed username.
  So i dump it char by char.</p>
  
  <p>The first name will be:
  CHARS: 193, 114, 118, 237, 122, 116, 26, 114, 26</p>
  
  <p>Suck.
  I tried to everything to get my real utf-8 name
  The mb_detect_encoding is UTF-8 for it.</p>
  
  <p>I tried to use iconv, mb_convert_encoding, utf8_encode and decode.
  No success. Tried to not urlencode the name, no success again.</p>
  
  <p>Can somebody tell me, why is it, and how can i get back the real utf8 name?</p>
  
  <p>The URL what i sent:
  cmd=_notify-validate&amp;mc_gross=10.00&amp;protection_eligibility=Eligible&amp;address_status=confirmed&amp;payer_id=JA3YMCJFKSCNJ&amp;tax=0.00&amp;address_street=1+Main+St&amp;payment_date=07%3A41%3A40+Sep+05%2C+2012+PDT&amp;payment_status=Completed*<em>&amp;charset=utf-8</em>*&amp;address_zip=95131&amp;first_name=%C1rv%EDzt%1Ar%1A&amp;mc_fee=0.59&amp;address_country_code=US&amp;address_name=%C1rv%EDzt%1Ar%1A+T%FCk%F6rf%FAr%F3g%E9p&amp;notify_version=3.6&amp;custom=lolka_bolka%3Bfalse%3B%3B%3B%3BHungary%3B%3B%3B%3B%3B%3B&amp;payer_status=verified&amp;business=vaso_1346830963_biz%40mydomain.hu&amp;address_country=United+States&amp;address_city=San+Jose&amp;quantity=1&amp;verify_sign=AVVJjJNeVwHbYcMDVfj2N1DqWwUdAtNQIpb9KIP99gZ2PY-LPoOYzSCc&amp;payer_email=test_1346830232_per%40mydomain.hu&amp;txn_id=4J747779YW528551F&amp;payment_type=instant&amp;last_name=T%FCk%F6rf%FAr%F3g%E9p&amp;address_state=CA&amp;receiver_email=vaso_1346830963_biz%40mydomain.hu&amp;payment_fee=0.59&amp;receiver_id=TGEHBCMG336WE&amp;txn_type=web_accept&amp;item_name=510+Silk&amp;mc_currency=USD&amp;item_number=&amp;residence_country=US&amp;test_ipn=1&amp;handling_amount=0.00&amp;transaction_subject=lolka_bolka%3Bfalse%3B%3B%3B%3BHungary%3B%3B%3B%3B%3B%3B&amp;payment_gross=10.00&amp;shipping=0.00&amp;ipn_track_id=6fe12a7a34b74</p>