0

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

  • 1
    You should look into character encoding -- this might help: http://stackoverflow.com/questions/905173/how-do-i-set-character-encoding-to-utf-8-for-default-html – sgeddes Jun 27 '13 at 01:01
  • I am using but it doesn't change a thing about that. It works on the whole website but not in the data that I get. –  Jun 27 '13 at 01:08

3 Answers3

1

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.

Lucas Freitas
  • 194
  • 12
  • I have even set the collation of the field itself to the right one "latin2_croatian_ci" but it still doesn't work. –  Jun 27 '13 at 01:55
0

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

5im
  • 224
  • 2
  • 13
0

I had to put this after connecting to my database

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