I'm trying to fix my auto return page to generate a name based license for some software. I've got PDT working and it gives me data back. However the name info has been converted to something other than Unicode and destroyed.
My test data is a user in the sandbox with a Japanese name. I attempt to run a transaction as that user and get this back:
last_name=%1A%1A
first_name=%1A%1A
In the PDT response. Some what ironically PayPal reports the content type as utf-8:
Content-Type: text/html; charset=UTF-8
Yah, nope. The test user's name is actually: 木家 寿司. Just some random Japanese characters.
My HTTP request is basically:
if ($method == "POST")
$r = "POST $usepath HTTP/1.1\r\n";
else
$r = "GET $usepath HTTP/1.1\r\n";
$r .= "Host: $host\r\n" .
"User-Agent: $ua\r\n" .
"Connection: close\r\n" .
"Accept-Charset: utf-8\r\n" .
"Accept: */*\r\n" .
"Accept: image/gif\r\n" .
"Accept: image/x-xbitmap\r\n" .
"Accept: image/jpeg\r\n";
if ($method == "POST")
{
$strlength = strlen($postdata);
$r .= "Content-type: application/x-www-form-urlencoded\r\n" .
"Content-length: $strlength\r\n".
"\r\n" .
$postdata;
}
Of note I set Accept-Charset to utf-8. I've also tried setting the content-type to include utf-8 as the charset. And also putting "charset=utf-8" in the form fields themselves.
Seems like PDT is just broken when it comes to unicode. Or am I doing something wrong here?
Edit: Bah, this is solved here.