php - Web page text display problem -
i keep getting these weird text characters when display user submitted text. in following example below. there way can fox using php, css or characters displayed properly?
here problem text.
problems of �real fonts� on web. 1 line summary: different browsers , different platforms �hinting�
here meta tag.
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
it's encoding problem. make sure send correct encoding browser. if it's utf-8, you'll this:
header("content-type: text/html; charset=utf-8");
also, make sure store content using same encoding throughout entire system. set database tables utf8
. if you're using mysql, run set names utf8
query when connecting make sure you're running in utf-8.
these weird characters occur when switch encoding.
also, functions in php take $charset
parameter (e.g. htmlentities()
). make sure pass correct charset 1 well.
to make sure php handles charset correctly in cases, can set default_charset
utf-8
(either in php.ini
or using ini_set()
).
Comments
Post a Comment