Answer the question
In order to leave comments, you need to log in
Where does the encoding error occur?
There is a form
<form accept-charset="UTF-8">
<input type="hidden" value="Русский текст">
</form>
<button id="ajax">
$.post(
"/handler.php",
{
data : $('input').val()
}
);
echo mb_detect_encoding($_POST["data"]); //Тут выводит UTF-8
$mysqli = new mysqli( *Тут данные* );
//$mysqli->query('SET NAMES "utf8"'); //Если расскоментировать эту строку все работает
$mysqli->query('INSERT INTO table (my_column) VALUES (data)');
Answer the question
In order to leave comments, you need to log in
//$mysqli->query('SET NAMES "utf8"'); //Если расскоментировать эту строку все работает
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question