K
K
kr_ilya2020-02-29 14:40:42
MySQL
kr_ilya, 2020-02-29 14:40:42

Why are question marks written in mysql instead of cyrillic?

I've already tried everything, but anyway, instead of Russian letters, this
???‚???‹?„?????‹?„?????‹?„????

I understand that the matter is in the encoding, but nothing can be done.
Here is the table
5e5a4cfd2b7c6797364695.png

In the script it is

mysqli_query($this->con, "SET NAMES 'cp1251'");
mysqli_query($this->con, "SET CHARACTER SET 'cp1251'");


I also want to add that everything is fine on OpenServer, but on hosting,

OS question marks
5e5a4f8f53443423033364.png
on hosting
5e5a4fc15eedf844688521.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUser0, 2020-02-29
@AUser0

Through SET NAMES, you specify what encoding "possesses" the data passed to MySQL.
If your site shows (and therefore accepts) data in CP1251 encoding, then yes, such SET NAMES is justified.
If the pages on the site are in UTF-8, then you are lying to MySQL that you have data in CP1251, because they are in UTF-8.
PS That you have a website in CP866 or in KOI-8, I won’t even assume ...

K
kr_ilya, 2020-02-29
@kr_ilya

The issue is resolved, the case was in the wrong encoding of the entire database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question