[英]PHP htmlentities Double Encoding
I'm trying to save the contents of a WYSIWYG input into an Oracle database. 我正在尝试将所见即所得的输入内容保存到Oracle数据库中。 Here's what I'm using: 这是我正在使用的:
$data = htmlentities($_POST['data'], ENT_QUOTES, "UTF-8");
My expectation is that when I'm going to put John's
as the value for the input, it will be saved on the database as John's
, but instead it is being saved as John'
我的期望是,当我打算把John's
作为输入值,它将被保存在数据库中的John's
,而是它被保存为John'
. 。
To me it looks like a double HTML entity encoding issue. 在我看来,这似乎是双重HTML实体编码问题。
Can you help me fix this? 你能帮我解决这个问题吗?
Browsing through the documentation , I noticed that the last parameter is a boolean for double encoding. 浏览文档时 ,我注意到最后一个参数是用于双重编码的布尔值。
$data = htmlentities($_POST['data'], ENT_QUOTES, "UTF-8", false);
did the trick. 做到了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.