1

I copied some chinese font and pasted in Sublime editor:

<?php
echo "木 mù";
?>

Now next I run it on Google browser test.php, it displays:

木 mù

So here you can see the characters that I'm using in echo and the character that browser is displaying are different. So my question is that: is it browser that does not support the font or is it PHP who does not understand it and displaying different result?

I need to declare('any character-set') in PHP file?

Thomas Orlita
  • 1,554
  • 14
  • 28
Dhairya Lakhera
  • 4,445
  • 3
  • 35
  • 62

1 Answers1

1

1. Set following meta tag in HTML

<meta charset="utf-8">

Documentation.

2. Set header via PHP

Use following code before any output to set header to utf-8 charset.

header('Content-Type: text/html; charset=utf-8');

PHP header() function.

Thomas Orlita
  • 1,554
  • 14
  • 28