Answer the question
In order to leave comments, you need to log in
Why does MySQL display question marks?
Good afternoon.
For an hour now I have been trying to understand what is the problem that appeared after moving to a dedicated server.
The fact is that when adding data to the MySQL database through a website, question marks appear instead of Russian letters.
When connecting to the database, I do the following: mysqli_set_charset($this->_db_connection, "UTF8");
In the file /etc/mysql/conf.d/utf8_charset.cnf the following:
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
init-connect="SET NAMES utf8"
[client]
default-character-set=utf8
mysql> SHOW GLOBAL VARIABLES LIKE 'char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
Answer the question
In order to leave comments, you need to log in
First, create a database in utf-8 (if you need this encoding), then re-upload the dump.
And the collation in the fields in the database/base itself is normal selected?
Look at what headers the site itself gives - maybe it's not UTF-8 all of a sudden?
when connecting with a database, write:
$connect = mysqli_connect('localhost', 'root', 'your_password', 'db_name');
then write the query
mysqli_set_charset($connect, 'utf8');
utf8 encoding can be replaced with cp1250, if it is set in your database
ps to see the database encoding, you need to select this database, and in the Structure look Comparison
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question