<ul>
<?php
  mysql_connect('localhost','htebhcom','r5w8f8') or die('database server no exists!');
  mysql_select_db('htebhcom')or die('database error!');
  mysql_query("set names utf-8");
  mysql_query("SET CHARACTER_SET_CLIENT=utf-8"); //服务器设置客户端编码
  mysql_query("SET CHARACTER_SET_RESULTS=utf-8");//设置查询结果的编码
  ini_set("display_errors", "off");
  date_default_timezone_set('PRC');
   
?>
<?php
  $result=mysql_query("select * from phome_ask_speak order by id desc limit 6");   
  while($arr=mysql_fetch_array($result)){
?>   
    
  <li><a href="[!--news.url--]ask/show.php?id=<?php echo $arr['id'];?>" target="_blank" title="<?php echo substr($arr['topic'],0,36);?>"><?php echo substr($arr['topic'],0,36);?></a></li>
<?php } ?>
  </ul>数据库编码是utf_8,页面head也有写 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 上面这短代码还是显示乱码。 请问是什么问题??????? 求指教····· 

解决方案 »

  1.   

    mysql_query("set names utf8");
    另外,确认你的文件也是utf-8编码
      

  2.   

    http://www.htebh.com/html/wenda.html 我做了个测试页面        那个文件我有设置utf-8
      mysql_query("set names utf-8");
      mysql_query("SET CHARACTER_SET_CLIENT=utf-8"); //服务器设置客户端编码
      mysql_query("SET CHARACTER_SET_RESULTS=utf-8");//设置查询结果的编码这乱码纠结一天了 求解决、、、  用的是帝国cms二次开发