CodeIgniter config charset and UTF-8 support

后端 未结 1 711
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 06:44

I\'m working on a website which uses / stores accented characters in the database. I have the page template set so that the config.php charset variable matc

相关标签:
1条回答
  • 2020-12-11 07:46

    You have to make sure that you use UTF-8 everywhere, and that both PHP and MySQL are configure to handle UTF-8.

    In the html, add the meta-tag:

    <meta charset="utf-8" />
    

    And save it in UTF-8 format. here is how to do that in notepad++.

    Define the MySQL tables to support UTF-8, create table with:

    DEFAULT CHARSET=utf8;
    

    And set the connection to:

    mysql_set_charset('utf8', $con);
    

    Enable UTF-8 in the php.ini:

    default_charset = "utf-8"
    

    For a full manual check Handling Unicode Front To Back In A Web App

    0 讨论(0)
提交回复
热议问题