Unicode Character Display Problem
I am trying to show नेपाल at my page, but is shows नेपाल. What i开发者_C百科s causing the unicode to render like this.
It's caused by something (likely the web browser) interpreting the characters as something else than Unicode. Browsers are quite bad at guessing the proper encoding, so it must be explicitly defined. Perhaps you should have something like this in the head
section:
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
It's also possible that the font being used does not cover those characters.
Write at the top of the script <?php header('Content-Type: text/html; charset=UTF-8');?>
If the data comes from a database then this
$mysqli->query('set character set utf8');
should help. Put it inside your db connection :-)
Reading from unicode.org:
If you are unable to read some Unicode characters in your browser, it may be because your system is not properly configured. Here are some basic instructions for doing that. There are two basic steps:
- Install fonts that cover the characters you need
- Configure your browser to use them.
精彩评论