The site stood on OpenServer on my machine, then transferred it to hosting from reg.ru. The result - all data that comes from PHP scripts are displayed as ???????? . What to do? Where to change PHP coding? Already tried to .htaccess add the default encoding and add the Content-Type to the <head> , nothing helps.
- the data comes from the database? - varz62
- @ varz62 Yes, the data comes from the database. Encoding in the database - utf8_general_ci - Alexxosipov
|
3 answers
after connecting to the database execute queries
$ mysqli-> query ("SET NAMES 'utf8'")
$ mysqli-> query ("SET CHARACTER SET 'utf8'")
$ mysqli-> query ("SET SESSION collation_connection = 'utf8_general_ci'")
|
The file needs to change the encoding itself. You take any IDE (development environment) with access to ftp , and change the file encoding.
- Changed, nothing happened, everything remained the same ( - Alexxosipov
|
Try php add header
header('Content-Type: text/html; charset=utf-8', true); |