我的网页上用的编码方式是utf8,
mysql_query("set names 'utf8'");
等搜索到的数据显示到网页上时还是有乱码怎么办?
mysql数据库存储中文没问题

解决方案 »

  1.   

    在输出的时候有没有加上mysql_query("set names 'utf8'"); 
    加上试试
      

  2.   

    我的页面编码是utf8的
    mysql数据库的编码也是utf8的,
    我用的是fleaphp+smarty
    不知道是不是fleaphp搞得鬼啊,
    我用fleaphp中Action中的方法execute("set names 'utf8'");
    也不行,现在还是解决不了,愁!!
      

  3.   

    在你的程序开头
    header("Content-Type:text/html;charset=utf-8");
    加上这一句
    跟你数据库没关系,是你浏览器编码问题
      

  4.   

    加上header("Content-Type:text/html;charset=utf8");还是不行
    编码方式utf-8和utf8有什么区别
      

  5.   

    你是按照我那样添加的吗
    你的程序编码是utf8吗
    header前必须不能有任何输出
      

  6.   

    这是控制器下面的一段代码:
    class Controller_Default extends FLEA_Controller_Action { function actionindex() { $userlist = FLEA::getSingleton('Table_List'); //得到一个数据库实例 $userlist->execute("set names 'utf8'");       //不知道这句这样写对不对 $rows = $userlist->findBySql('SELECT * FROM userinfo',20); $userlist->execute("set names 'utf8'");   header("Content-Type:text/html; charset=utf8");  $this->smarty = $this->_getView(); $this->smarty->assign('result',$rows); $this->_executeView('haha.html');
    }
    }页面上除了html标签和输出之外还有<meta http-equiv="Content-Type" content="text/html; charset=utf8" />其他的没有了
      

  7.   

      'responseCharset'=>'UTF-8',  看一下, 有没有配置这个选项
      

  8.   

    mysql_query("set names 'UTF-8'");
      

  9.   

       他在使用的是FleaPHP的框架,  要么查看文件的编码, 要么检查一下框架的配置吧.
      

  10.   

    <?php header("Content-Type:text/html;charset=utf-8");  ?>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />确保这两句都有。
    表单提交后输出下值,看输出的是否正确。
    不正确的话,<form>中加enctype="multipart/form-data"我前几天也是乱码,后来上面的方法解决了。不知道是不是和我的情况一样的
      

  11.   

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />