I'm attempting to send a string from client-side JavaScript to a back-end PHP script. The string contains special quotes like ’
and “
.
When I look at the console in Chrome I can see that these are sent in the POST headers as they are. On the PHP side I then immediately json_encode()
the $_POST
array and send it back to see what its collected. The special characters now look like this \u2019
. This is for testing please note I would normally sanitize all post data.
I wish to use UTF-8 but I'm not sure what I'm missing. My HTML includes:
<meta charset="utf-8">
My PHP server has UTF-8 set as its default charset.
If I start saving such data to the database I start ending up with strings like this: âÂÂ
for ’
. However this is not a database issue the characters are already bad before going into the database. MySQL purely accentuates them.
Any ideas?
Update
I've noticed that if I return the string back to javascript without using json_encode()
then it's in its original format with the special quotes (’
and “
) still.