PHP和Mysql UTF-8的问题(特殊字符) [英] Problem with PHP and Mysql UTF-8 (Special Character)

查看:95
本文介绍了PHP和Mysql UTF-8的问题(特殊字符)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一个名为(ProductTitle)的文本框的表单

如果我在文本框中输入Étuit"作为示例,然后单击保存",则将数据发布到名为Product的表中. ProductTitle数据库的结果int是puit.我关心的是特殊字符.我没有将É放入数据库中,而是得到了‰.

当我从数据库中将产品标题(Étuit")加载到跨度中时.可以正确显示.
但是,当我将其加载到用于编辑产品标题的文本框中时,显示为"tuit".

任何人都知道为什么.

我把它放在html头

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

注意::当我单击表单上的保存"时,将使用jquery ajax方法发布数据.

解决方案

看看 utf8_encode() utf8_decode().还可以看看多字节字符串函数.

I Have a form with one textbox called(ProductTitle)

if I write as example "Étuit" in the textbox and click on Save, I post the data in a table called Product. The result int the database for ProductTitle is Étuit. My concern is about the Special character. Instead of putting É in the database , I got that É

When I Load the Product Title ("Étuit") from the database into a span. That show correctly.
BUT When I load it inside a Textbox to Edit the Product Title, that show Étuit.

Anybody know why.

I Put that in the html head

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

Note : When I Click save on the form, the data is posted with jquery ajax method.

解决方案

Take a look at utf8_encode() and utf8_decode(). Also take a look at multibyte string functions.

这篇关于PHP和Mysql UTF-8的问题(特殊字符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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