0

Inside a sql data database I have some filed with Thai character. When I'm querying the database to display these name, some character are displaying, but some are not, question marque instead of the character.

Any idea what should I do to display the whole name?

So far I added this in my html:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-874">
<META HTTP-EQUIV="Content-language" CONTENT="th">
user3636476
  • 1,357
  • 2
  • 11
  • 22
  • 1
    Best piece of advice I ever received: **Use UTF-8 everywhere**. This includes the db, the db access layer (PDO/mysqli) and the html. – Francisco Presencia Jun 06 '14 at 04:26
  • what do you mean? how are you using it please? – user3636476 Jun 06 '14 at 04:27
  • What character encoding are you using for the database? I'd recommend setting it to UTF-8, since it will be available for all languages. – Francisco Presencia Jun 06 '14 at 04:28
  • yes it's already set to UTF-8, I have this header: header('Content-Type: text/html;charset=utf-8'); – user3636476 Jun 06 '14 at 04:32
  • There are mainly, but not only, 3 places to check for the encoding: the db, the PDO/mysqli access and the html. And they should have the same charset, either UTF-8 or whichever charset you are using (or compatible ones). – Francisco Presencia Jun 06 '14 at 04:34
  • ok thanks, I think I solved my issue, I was using substr to troncat the name, now I'm using mb_substr($name, 0, 25, 'UTF-8') and it seems to work – user3636476 Jun 06 '14 at 04:47
  • 1
    See http://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Phil Jun 06 '14 at 04:49

0 Answers0