0

The website works and displayed correctly. But in the database, there is a lot of symbols like 'Â', ​ and so. Any new entry in SQL is created with such symbols - but displayed properly on the Website.

The database is in UTF encoding. The majority of the files too. But there are some files in ANSI (Windows-1252). I changed files that I found, it didn't help, there are hundreds of files...

By default, the browser shows website at UTF encoding. If I manually change to Windows-1252 in the browser, the characters starting to appear.

If I exporting SQL DB as UTF - characters are present in the damp. If I exporting SQL DB as Windows-1252 the characters are not there.

Why the website display content properly, but in the DB there is some problem? How to solve this?

VGranin
  • 363
  • 6
  • 15
  • See "Mojibake" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Nov 18 '17 at 15:00

1 Answers1

3

You can use mysqli_set_charset('utf8');

Object oriented style

bool mysqli::set_charset ( string $charset ) Procedural style

bool mysqli_set_charset ( mysqli $link , string $charset )

Sets the default character set to be used when sending data from and to the database server.

user10089632
  • 5,216
  • 1
  • 26
  • 34