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.

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

报告相同问题?

悬赏问题

  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)
  • ¥66 比特币地址如何生成taproot地址
  • ¥20 数学建模数学建模需要
  • ¥15 关于#lua#的问题,请各位专家解答!
  • ¥15 什么设备可以研究OFDM的60GHz毫米波信道模型
  • ¥15 不知道是该怎么引用多个函数片段
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥15 隐藏系统界面pdf的打印、下载按钮