Reputation: 70466
I want to pass any text as a get parameter to a php script. For know I just append the text this way:
action.php?text=Hello+my+name+is+bob
This url is composed by javascript and I do a ajax request with this url.
In action.php I do
$encoded = array_map('rawurlencode', $_GET);
But this does not work for special chars like ÖÄüä
.
Any idea how to solve this?
Upvotes: 2
Views: 6615
Reputation: 1744
url_encode(string) will return the given string with special characters converted into %XX format.
https://www.php.net/manual/en/function.urlencode.php
I know you can send special characters fine without encoding through $_POST, which is another alternative
Upvotes: 3