Hello. It would seem that the problem is trivial to ugliness, but having scrolled through several forums, I did not find an intelligible clear-cut solution.

The database stores data in Russian. When I try to display them, I get "?????????". Where is the problem? Immediately add: -coding site utf-8 -coding script files utf-8 without BOM -coding tables utf-8 (comparison utf8_general_ci)

When developing everywhere I tried to set utf-8. But still stumbled upon this problem. Moreover, everything on the local server works without problems. When transferring to real hosting - "?????" instead of Russian characters.

There is still one moment. If the data is added to the database from the script, then they are also entered by the krakozabrami - "´ROOM ²".

I hope for your help.

  • Looks like the original cp1252 encoding? - Andrey

2 answers 2

When connecting to the base, try one thing.

SET CHARACTER SET utf8 

or

 SET CHARACTER SET cp1251_koi8 

Well, or write your own, where the encoding is through the dash _ (cp1251_koi8), this means it will be converted from one encoding to another

  • Hmm, so everything just turned out. Thank you very much. Helped - SET CHARACTER SET utf8. - Stifax

Before any requests (I set immediately after connecting to the database):

 $mysqli->query("SET NAMES UTF8"); $mysqli->set_charset("utf8"); 

This is for MySQL, but for MySQL you can forward it there in accordance with the documentation.