I've got a little issue with AJAX request. I request some data from database using jQuery $.post, but all the special characters are lost. I did some testing and I've figured out, that it stores the data incorrectly in $_SESSION
, but it only occurs with AJAX request when the file contains only PHP (in html files I have a <meta charset="utf-8">
markup and it seems to work for PHP too). Of course I've tried adding header('content-type: text/html; charset: utf-8');
to the code, but it doesn't work. What could it be?
Asked
Active
Viewed 238 times
0

Fiodor
- 796
- 2
- 7
- 18
-
In which encoding are the PHP files saved? Check this [question](http://stackoverflow.com/questions/275411/php-output-showing-little-black-diamonds-with-a-question-mark). – Pietro Saccardi Feb 23 '14 at 11:41
-
The PHP files are saved in the same encoding as html files which have no issues with special characters. – Fiodor Feb 23 '14 at 11:44
-
It shouldn't affect PHP behaviour, but make sure that `default_charset = "UTF-8"` is turned on in php.ini. – Pietro Saccardi Feb 23 '14 at 12:26
-
any updates on this ? – Jul 21 '16 at 18:08