1

I have a problem with outputting HTML in PHP. I read the values from a MySQL database, wich is utf8_bin encoded. When i have a normal HTML document, it outputs the letters Č, Š and Ž completely normal. But, when i read the values from the database, these characters look like this: �

I used a solution that i found on stack:

header('Content-Type: text/html; charset=ISO-8859-1');

And it worked... But only for the php part, the HTML was now the one that was causing me the problems.

You can check the site if you would like to see the code: http://najdistoritev.si/kategorije.php?kategorija=avtomobilizem-in-prevoznistvo

Currently it is set as it was, before implementing the previous solution.

Any ideas?

Qirel
  • 25,449
  • 7
  • 45
  • 62
Tadej Bogataj
  • 399
  • 1
  • 4
  • 13
  • 2
    You shouldn't ever mix charsets, it will only lead to more problems. UTF-8 has most, if not all, characters you'll ever need, so I suggest you use that for your application/platform. That being said, the entire pipeline of your code has to have the *same* charset. I have previously posted [**answers**](http://stackoverflow.com/a/31899827/4535200) with a little "checklist" which may come in handy. – Qirel Mar 09 '17 at 07:33
  • can you show us the queries (may be obfuscated) you send to the database from the beginning? – Edmund Dantes Mar 09 '17 at 07:33
  • Black diamonds are discussed [_here_](http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored) – Rick James Mar 13 '17 at 04:34

0 Answers0