N
N
Nick Bukovskiy2017-09-27 11:54:49
PHP
Nick Bukovskiy, 2017-09-27 11:54:49

Incomprehensible characters when transferring data to the database, how to fix?

I enter data into the database. Those data that come from the post request are added to the database in the form of Тульчин . And in general, even if you create a variable and insert a string there, transfer it - the result is similar. But if you write the line "test" in the request for additions, it is displayed adequately in the database. What's the matter?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Sanych, 2017-09-27
@sonterix

$dbh = new PDO("чтототам",  $user, $password);
$dbh->exec("set names utf8"); // добавить эту строку

G
goshan_p, 2017-09-27
@goshan_p

Check encodings. I'm not sure exactly on Java + MySQL met with the fact that instead of Russian letters it outputs strange characters to the console

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question