There is a table in the database. It has meaning in Cyrillic. Suppose "Murmansk". Everything is perfectly displayed, no problems with the encoding.

However, in php, with output, I get "nKhTNBOUL" instead of "Murmansk".

mysql_set_charset ("utf8", $ db) does not help.

Versions:

php 5.5.9-1ubuntu4.24 / 10.0.33-MariaDB 

Variables with DB encodings:

Variables with encodings

  • What kind of output? Where are you taking? - Anton Shchyrov pm
  • @ anton-shchyrov. just a page, while ($ row = mysql_fetch_array ($ result)) {echo $ row [title]} - Turambar
  • Does the page header indicate that it should be displayed in UTF-8? - Anton Shchyrov
  • @ anton-shchyrov, <meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> - Turambar
  • All figured out. Hang up :) The problem, as I understood it, was that the data was put into the database through putty in some other encoding. If you bring them through a php script in utf-8, then everything is fine. - Turambar

1 answer 1

It doesn’t need this: mysql_set_charset("utf8", $db) is outdated on your version, but the following line: mysql_query ('SET NAMES utf8 // current in such brackets `` yutf8'); will be displayed in Russian