O
O
onogur2014-04-20 13:30:28
PHP
onogur, 2014-04-20 13:30:28

Missing encodings in MySQL

In MySQL, the encodings have flown. At first, everything changed to latin1, then I, through the SET NAMES utf8 request, seemed to be rearranged to utf8. But when writing to the database from a web application in PHP, the Cyrillic alphabet is written in the form of kryakozyabr, which I have not seen before. I tried to insert the SET NAMES utf8 command in PHP before each request, the cracks changed to a set of question marks ???????. And what is most interesting, when outputting data from the database to the pages of the web application, question marks are also displayed, although with the first version of the kryakozyabr everything was output normally! What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Snewer, 2014-04-20
@Snewer

Specify the encoding when connecting to the database:

$db = new mysqli('127.0.0.1', 'user', 'pass', 'db');
$db->set_charset('utf8');

You need to specify "utf-8" in htaccess and not "utf8":
AddDefaultCharset utf-8

D
DDanya, 2014-04-20
@DDanya

Didn't think to use Google? Do you have the correct encoding in your script?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question