Passing GET variables from Flash to PHP using Chinese characters

I call the php file from Flash and add the following variables as follows: http://www.randomwebsite.com/something.php?title= 爸爸

It works fine if I copy and paste it directly into a web browser, however, if I call it via flash, the address bar will end as follows: something.php? title = ??

Is there anything I can do with PHP or flash to encode / decode a string? Any help is appreciated.

Thanks, Will

EDIT: Thanks guys, this method worked just fine. Everything responds well, however, I now have some problems with inserting information into my database via MySQL, all my fields are configured to UTF-8. I get some weird characters instead of Chinese characters.

Thanks a lot, Will

+3
source share
5 answers

If you have problems inserting into the database, you need to make sure that everything related to the process is utf8. If you tested your request in phpmyadmin and it works fine, I would suggest adding the following request to your php script:

mysql_query("SET character_set_client=utf8", $connection);
mysql_query("SET character_set_connection=utf8", $connection);
+1
source

You need to specify the URL encoding parameters that you put in the query string. Although IRIs may contain a literal , URIs cannot. It must be encoded as %E7%88%B8. (It will still appear as in the address bar, except in some cases in IE.)

encodeURIComponent() is a function executed in JavaScript / ActionScript.

+3

. rfc1738 2.2 (http://www.faqs.org/rfcs/rfc1738), . , Flash, PHP (raw-) urlencode() (raw-) urldecode() .

0

URL-encode ( , , ). , URL- (, ) (, '?' '&').

, , ASCII, Unicode. , encodeURIComponent() Flash % xx Unicode.

0

Source: https://habr.com/ru/post/1740149/


All Articles