开发者

Web page text display problem

I keep getting these weird text characters when I display user submitted text. like in the following example below. Is there a way I can fox this using PHP, CS开发者_开发技巧S or something so that the characters are displayed properly?

Here is the problem text.

Problems of �real fonts� on the web. The one line summary: 
different browsers and different platforms do �hinting�

Here is my meta tag.

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />


It's an encoding problem. Make sure you send the correct encoding to the browser. If it's UTF-8, you'll do it like this:

header("Content-type: text/html; charset=utf-8");

Also, make sure that you store the content using the same encoding throughout the entire system. Set your database tables to utf8. If you're using MySQL, run the SET NAMES utf8 query when connecting to make sure you're running in UTF-8.

These weird characters occur when you suddenly switch encoding.

Also, some functions in PHP take a $charset parameter (e.g. htmlentities()). Make sure you pass the correct charset to that one as well.

To make sure that PHP handles your charset correctly in all cases, you can set the default_charset to utf-8 (either in php.ini or using ini_set()).


Set your page to UTF-8 encoding.


Please check with the char-set in header section.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
use this below one:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

or try this one:

htmlentities($str, ENT_QUOTES);


Could be problem with file encoding please check that your files is correctly encoded, saved as "UTF-8 without boom", also if you are saving to database use SET NAMES UTF-8

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜