如何使用php将数据库mysql中的é,ê,...转换为普通字符串é,â,...? [英] how to convert é,ê,... in database mysql to the normal string é,â,... using php?

查看:115
本文介绍了如何使用php将数据库mysql中的é,ê,...转换为普通字符串é,â,...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mysql中存在数据问题.

某些数据存储区,其字符串如(1): "hello & hello ' hello è ...".还有一些数据存储,其字符串为(2): "hello à hello é hello ê ...".

我可以将字符串(1)解析为普通字符串,但是我不知道如何将字符串(2)转换为普通字符串?/p>

注意:我们无法更改现有数据库中的数据:/ 同样,这两个样本都存储在同一张表中,并且该表的字符集是latin1!

解决方案

hello à hello é hello ê可能是UTF-8解释为ISO-8859-1.

您可以更改解释,例如在浏览器中设置一个字符集,或使用utf8_decode()将该字符集转换为ISO-8859-1.

There are the problems of data in mysql.

Some data store with the string like (1):"hello & hello ' hello è ...". And some data store with the string like (2):"hello à hello é hello ê ...".

I can solve the string (1) to the normal string, but I don't know how to convert the string (2) to the normal string?

Note : We can not change the data in the existing database :/ Also the both sample is store in the same table and the charset of the table is latin1!

解决方案

hello à hello é hello ê probably is UTF-8 interpreted as ISO-8859-1.

You can either change the interpretation, e.g. in a browser set a charset, or convert it to ISO-8859-1 using utf8_decode().

这篇关于如何使用php将数据库mysql中的é,ê,...转换为普通字符串é,â,...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆