douyan6871 2014-06-20 06:25
浏览 51
已采纳

存储在MYSQL中的中文字符不会显示在CI中

I have my mysql field as collation - utf8_general_ci , when i enter the chinese characters and submit the form , it gets stored into the database fine, but when it is displayed in the view page the format differs . Below are the settings i had used

In config.php

$config['charset'] = 'UTF-8';

In database.php

$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

And my HTML header meta tag is

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

Though i had configured all the possibilities

The chinese character displays as

中央情报局出版和更新国家的酋长和外国æâ€Â¿Ã¥ÂºÅ“的内é˜ÂæˆÂ员æ¯Â周一次的在线目录。该目录的目的是将主è¦Â作为å‚考æ´助和包括世界许多æâ€Â¿Ã¥ÂºÅ“作为被认为是实çâ€Â¨Ã¯Â¼Å’有些人没有正å¼Â被美国承认。制度与

where else in db it is stored as

中央情报局出版和更新国家的酋长和外国政府的内阁成员每周一次的在线目录。该目录的目的是将主要作为参考援助和包括世界许多政府作为被认为是实用,有些人没有正式被美国承认。制度与

I have also tried utf8_decode(); in the view page, but it also didn't work. Could anyone suggest me a solution. Thanks in advance.

  • 写回答

1条回答 默认 最新

  • douxian4376 2014-06-25 09:10
    关注

    I had included mb_internal_encoding('UTF-8'); header('Content-type: text/html; charset=UTF-8') ; in the header

    It works fine now. Thanks guys for your comments.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?