简体   繁体   中英

Same charset html and sql but errors

in this example I'm working with html, php and sql. There is an SQL table with a field that is "utf8_unicode_ci". I want to put this field wich contains html code and italian text, but could be chinese or russian into an html page that is displayed by browsers.

Into the html page there is this:

<meta charset="utf-8">

The problem is that the text is displayed with some strange charachters, can you help me please?

Do you set utf-8 on mysql connection? After connecting, execute this query: set names 'utf8'

Verifique a configuração do conexão no arquivo app/config/database.php

    public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => '12345',
        'database' => 'myDb',
        'encoding' => 'utf8'
  );

Also check the configuration of the table and field that can be configured with another charset

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM