简体   繁体   中英

Encoding Issue with PHP and MySQL

In MySQL with phpmyadmin my text looks like:

& eacute; <-- no space, added to see.

When I read it into PHP and print it to the error_log it looks like:

\\xe9

When I try to look at it in a web browser it looks like:

It should look like this in the web browser:

é

Does anyone know what is wrong?

my html page has the tags

<meta charset='UTF-8'>
and
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

您的数据库是否设置为使用uft8_unicode_ci字符集?

Solved:

I had to change the my.cnf file my MySQL

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

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