如何使用codeigniter在mysql中插入带有特殊字符的文本

问题描述:

我试图在mysql数据库中插入一个包含特殊字符的文本(例如:'é')
文本被插入,'é'被替换为'?'
i am using codeigniter active记录

I am trying to insert a text in mysql database that contains special chars (example : 'é' ) the text is inserted and 'é' is replaced with '?' i am using codeigniter active record

任何人都可以向我解释如何做到这一点?
提前感谢!

Can anyone explain to me how to do that? Thanks in advance!

多语言数据所需的以下几点:

Following points required for multilingual data insert:


  • 使用集合utf8_unicode_ci创建数据库。

  • 创建您的数据库表,并确保您已选择/写入集合设置为

  • 现在来到codeigniter部分,并检查您的数据库配置文件的位置如下所述

  • Create your database with collection "utf8_unicode_ci". Basically this allows Unicode (multilingual), case-insensitive data to be saved in your database.
  • Create your database table and make sure you have selected/written collection set to be "utf8_unicode_ci" for all the table fields.
  • Now comes to codeigniter part and check your database config file with location as mentioned below

application / config / database.php

检查&更新字符集

Now please check & update charset & collection settings as mentioned below

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