htmlentities销毁utf-8字符串 [英] htmlentities destroys utf-8 strings

查看:114
本文介绍了htmlentities销毁utf-8字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里发生了一些奇怪的事情,我不明白为什么在我的php 5.2.5服务器上(仅在Linux上,Windows php服务器没有相同的问题) 当我使用POST表单将内容发布到包含é"的输入上,而另一方面,我

I got something weird happening here and I can't understand why, on my php 5.2.5 server (Just on Linux ,Windows php servers doesn't have same problem) When I use a POST Form to post the content on an input containing "é" and on the other side I

echo(htmlentities($_POST["myinput"])) 

它回显é

但是如果我回应我的

$_POST["myinput"] 

简单地显示为é",这意味着我的htmlentities默认情况下不使用UTF-8,在哪里可以更改htmlentities使用的字符集?

simply it shows "é", so this mean my htmlentities doesn't use UTF-8 by default, where can I change the Charset used by htmlentities?

我尝试在php.ini default_charset ="UTF-8"中进行更改,但是它也不起作用?

I tried changing it in my php.ini default_charset = "UTF-8", but it won't work either?

推荐答案

htmlspecialchars($str, ENT_QUOTES, "UTF-8")

这也比仅htmlentities()

这篇关于htmlentities销毁utf-8字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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