i realized when I used urlencode or rawurlencode in PHP encoding a simple ยง character (paragraph), I get the following result: "% C2% A7".
But when I use escape in Javascript to encode this character, I get only "% A7".
In this case, I have problems with encoding when sending / receiving data between the server running PHP and the javascript client trying to retrieve data through ajax / jquery.
I want to write any text that I want. To do this, I encode the text and send it to the backend php script, avoiding data transfer and sending. When I get it, on the php side, I take the data from mysql and make rawurlencode and send it back.
Both sides operate in UTF-8 mode. The jquery ajax function is called with "contentType: application/x-www-form-urlencoded:charset=UTF-8", the mysql server is installed for UTF-8 for both the client and the server, and the PHP script starts echoing withheader( "application/x-www-form-urlencoded:charset=UTF-8");
Why does PHP create this% C2 thing that generates a ร character on the javascript side.
Will someone help the cult?
source
share