Answer the question
In order to leave comments, you need to log in
Why is the data in the session not written correctly?
PHP script crookedly writes data to the session. The page is encoded in utf-8. AJAX accessing the script, writing data, looking at the session dump - instead of Russian krakozyabry. What could be the problem? Or is it obligatory to convert? In the script itself, I tried to send the header with the correct encoding - it did not help. Thank you.
Answer the question
In order to leave comments, you need to log in
It was all about htmlentities. It was written without encoding. Specified encoding(htmlentities($_POST['comment'], ENT_QUOTES, "UTF-8")) and everything worked. Thanks :)
The problem is that when you call with Ajax, you do not start the session. or the session starts later.
You can solve the problem by passing the language parameter directly in the ajax request.
Also, the session can be rubbed when processing requests for images, javascripts or styles when they are processed by PHP scripts. This leads to the fact that the variable in the session is not overwritten and later the session loses the desired value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question