POST from Flash (AS2) to PHP, outputs ??? when non-english characters are used -


i trying use post in flash (actionscript 2), post values php mail script. tried php mail script html form, , worked fine.

but when post flash , input non-english characters, "????" in mail.

i tried utf8_encode($_post["name"]), doesn't help.

edit:

i tried utf8_decode($_post["name"]), didn't work.

update: (so wont have go through comments)

  1. i checked variables in flash, values stored correctly.
  2. the html page flash embedded utf-8 encoded.
  3. i watched post headers firebug, post messed up, showing "????" instead of real value.
  4. the messed "????" value, url-encoded flash, , decoded php, resulting in $_post["name"] == "???";

i suspect sendandload method creates mess.

update:

here flash code:

system.usecodepage = true; send_btn.onrelease = function() {    my_vars = new loadvars();    my_vars.email = email_box.text;    my_vars.name = name_box.text;    my_vars.family_box = comment.text;    my_vars.phone = phone_box.text;  if (my_vars.email != "" , my_vars.name != "") {     my_vars.sendandload("http://aram.co.il/ido/sendmail.php", my_vars, "post");     gotoandstop(2); } else {     error_clip.gotoandplay(2); } my_vars.onload = function() {     gotoandstop(3); }; };      email_box.onsetfocus = name_box.onsetfocus=message_box.onsetfocus=function () { if (error_clip._currentframe != 1) {     error_clip.gotoandplay(6); } }; 

flash uses utf8-encoding strings, anyway. if use loadvars, transfer urlencoded string should work automatically.

so problem in php part of application. example, in order utf8 work correctly, all individual php files must saved in utf8-encoded format, well.

if changing file encoding doesn't work, try parsing $http_raw_post_data first, check if fields have been transferred correctly, go on , echo way through until find place encoding lost.

update:

here problem: use system.usecodepage = true;. requires specifically encode data unicode before sending it. unless have other documents in other encodings, and/or allow users upload own text data localized encodings, set system.usecodepage = false;, , utf8-problem should go away.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -