SQL的特殊字符显示为? 在HTML中

In my tabel I have this special character for example "č"

When I select and display this data as html on my website it shows that character as a question mark (?).

How could I solve this?

Example Table

Mehanički

Example HTML output

Mehani?ki

Im using PHP to get the data from SQL and I call the PHP file with AJAX to get the output which is an array

I guess you have to set your html encoding to that one you use in the database.

put <meta charset="utf-8"> in your head block.

Also, the collation of your database should be utf8_unicode_ci.

ALSO, your source-code should be encoded in utf8 too.

I had to put this after connecting to my database

if (!$mysqli->set_charset("latin2")) {
    printf("Error loading character set latin2 : %s
", $mysqli->error);
}