It is given : there is a correctly working PHP application with a database located on the hosting and on the home Windows PC (Open Server).
Task : transfer and run this application on MacBook_e (OS X).
Problem : data from the database is not displayed correctly in the application (displays question marks - ?????)

Installed MAMP, moved the database, downloaded all the application files.

UTF-8 encoding is written in the application header. The base is encoded utf8_unicide_ci.
Tables are encoded utf8_unicide_ci.

Data NOT from the database is displayed correctly. Data from the database - ?????.
What solutions are there?

  • in the database itself is correct? - Naumov
  • Yes, the database data is correct. - Kanzafarov S.
  • Describe in more detail how the database was transferred? How was the dump created? Does it have a connection encoding setting? - cheops

1 answer 1

Most likely the connection encoding is not set in the SQL dump. As a result, the MySQL server expects data in latin1, which it converts to utf8, i.e. you feed data to utf8 at the input, and he is trying to do a latin1-> utf8 conversion. The result is broken data. To solve the problem, it is best to open the SQL-dump and first write the string

SET NAMES utf8; 

It will inform the server that the coding of the session will be utf8 and no additional conversions are required.