Problems displaying French accented characters in UTF-8

前端 未结 4 1829
清酒与你
清酒与你 2021-01-12 07:14

I\'m working on a French language site built in CakePHP. I have tried multiple functions to try and convert the text into UTF-8 and display properly, but have had no succes

4条回答
  •  心在旅途
    2021-01-12 07:31

    Check your @@character_set_results. By default, MySQL uses latin1, not utf8. Try SET NAMES utf8 or mysqli::set_charset.

    Update: here is how you might check the character sets in use:

    mysql> SHOW VARIABLES LIKE '%char%';
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | utf8                       | 
    | character_set_connection | utf8                       | 
    | character_set_database   | utf8                       | 
    | character_set_filesystem | binary                     | 
    | character_set_results    | utf8                       | 
    | character_set_server     | utf8                       | 
    | character_set_system     | utf8                       | 
    | character_sets_dir       | /usr/share/mysql/charsets/ | 
    +--------------------------+----------------------------+
    

    Read more on dev.mysql.com.

提交回复
热议问题