mysql – Displaying the Cyrillic alphabet in the database with crocozyabs (NOT question marks)

Question:

Good afternoon everyone!

There is a complete zero in the database, so I ask you to forgive in advance, do not throw slippers and give answers "as for a beginner."

The essence of the problem.

There is a Website. Is on LAN (XAMPP). The essence of the site is that an Instagram account is located by nickname and then statistics are kept on it.

Everything works fine on the site. Both Latin letters (nickname itself, etc.) and Cyrillic (nickname description) are displayed. All information (both nickname and description) is pulled from instagram. I do not enter anything myself.

But in the database for this site (where everything is saved) in the instagram_users table in the full_name and description columns (where there should be information about the account in Cyrillic), this is the display

In the middle of the night Cosmo, Grazia, Lady Mail.Ru sooner or later ¸

The automatic character set identifiers give out that it is CP1252, but the output text is still not perfect (although much better). It turns out like this

Tat�na Timofeeva ▪��Female dressing room ▪��Columnist SNC, Cosmo, Grazia, Lady Mail.Ru ▪��Online-courses �til� 📩 tt@shoppingschool.ru 🎓Online-school and BLOG ⤵��

At the same time, the website page itself contains <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

The database itself was created in utf8mb4_unicode_ci encoding

the type of problem columns is varchar

Accordingly, the question Tell me, please, is there a way to ensure that everything is displayed correctly in the database itself (Cyrillic)? And How 🙂

I understand that I am asking a lot, but if you say how to do it, then a huge request to write not only what to do, but where and how. I am sure that this will help many beginners in solving a similar problem (because I have not found a normal step-by-step description of how to solve this problem anywhere :()

Thanks in advance!

UPD

Database server
Server: 127.0.0.1 via TCP / IP

Server type: MariaDB
Server connection: SSL not used
Server version: 10.1.31-MariaDB – mariadb.org binary distribution
Protocol version: 10
User: root @ localhost
Server encoding: UTF-8 Unicode (utf8)

Web server
Apache / 2.4.33 (Win32) OpenSSL / 1.0.2n PHP / 7.1.16
Database client version: libmysql – mysqlnd 5.0.12-dev – 20150407 …
PHP extension: mysqli curl mbstring
PHP version: 7.1.16

phpMyAdmin
Version info: 4.8.0, latest stable release: 4.8.2

Answer:

The database itself was created in utf8mb4_unicode_ci encoding

The base can be created in one encoding, and the application can access it in a different encoding. In scripts that work with a database, the encoding is usually indicated by the "SET NAMES utf8mb4" query.

A common mistake. If the default encoding in the mysql server settings does not match the desired one, and the encoding is not specified in your application, then they will interact in the server encoding. Since the application both reads and writes in the same encoding (Latin for example), you will not notice the difference in the application itself, but phpmyadmin, configured for utf, will show "krakozyabry".

Solution. Initially set up utf encoding in your application

Scroll to Top
AllEscort