Chinese characters not showing in php from mysql database

I am working on one project that uses multilingual content

http://school.rssas.org

Problem: Chinese characters do not appear in the database

Actually, it works on the local host with the same database files. When I upload it to the server, the charters do not support, but at the same time they work fine on the local computer, I tried all the solutions related to the database.

http://school.rssas.org

+5
source share
1 answer

try it

header('Content-Type: text/html; charset=utf-8'); 

It is also sometimes necessary to clarify that the user sends / waits for UTF-8 encoded data when connecting to the database, so MySQL believes that it should process the encoded latin1 data and convert it accordingly. Run the SET NAMES utf8 command after connecting to db

Please let me know if it still does not work.

+1
source

Source: https://habr.com/ru/post/1239188/


All Articles