PHP字符集口音问题 [英] PHP charset accents issue

查看:86
本文介绍了PHP字符集口音问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页中有一个表单供用户发表评论。



我目前正在使用此字符集:

  meta http-equiv =Content-Typecontent =text / html; charset = ISO-8859-1

但从DB重音符中检索注释不正确( Ex。è=>Ã)。



我需要哪些参数来正确处理重音?



SOLVED >


  • 将meta标记更改为charset ='utf-8'


  • 更改字符集Mysql(ALTER TABLE注释CONVERT TO CHARACTER SET utf-8)


  • 在插入记录和检索时更改了连接字符集 - > query('SET NAMES utf8'))




现在的口音正在显示正确



感谢



Luca

解决方案

ISO-8859-1字符集仅适用于拉丁字符。尝试UTF-8,并确保数据库这些字符来自也是UTF-8列。


I have a form in my page for users to leave a comment.

I'm currently using this charset:

meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" 

but retrieveving the comment from DB accents are not displaying correct ( Ex. è =>è ).

Which parameters should i care about for a correct handling of accents?

SOLVED

  • changed meta tag to charset='utf-8'

  • changed character-set Mysql (ALTER TABLE comments CONVERT TO CHARACTER SET utf-8)

  • changed connection character-set both when inserting records and retrieving ($conn->query('SET NAMES utf8'))

Now accents are displaying correct

thanks

Luca

解决方案

The ISO-8859-1 character set is for Latin characters only. Try UTF-8, and make sure that the database these characters are coming from are also UTF-8 columns.

这篇关于PHP字符集口音问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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