从 Outlook 复制/粘贴到 Internet Explorer 时 PHP 网站出错
我们的一些用户在将文本从 MS Outlook 复制并粘贴到我们 PHP 网站的文本区域框中后遇到问题(在 IE 中运行,在其他浏览器中似乎工作正常)。具体来说,内容显然是正确粘贴的,但是当数据传回服务器并存储在 PostgreSQL 数据库中时,数据库中实际上没有存储任何数据(我要检查 PHP 是否接收到它)在 $_POST
变量中,完成后我将发布更新)。
这听起来像是富文本格式的问题,或者可能是粘贴内容的编码问题。
有谁知道我们可以应用于 PHP 站点以强制文本区域仅接受 IE 的纯文本(或自动转换它)的解决方案吗?
谢谢!
更新:遗憾的是,我无法使用 Outlook Express 在 IE 6、7 或 8 上重现该错误。也许这是用户错误...当我弄清楚实际问题是什么时,我会更新更多信息。
Some of our users are experiencing a problem after copying and pasting text from MS Outlook into a text area box on our PHP site (running in IE, seems to work fine in other browsers). Specifically, the contents are apparently pasted properly, but when the data is passed back to the server and stored in the PostgreSQL database, no data is actually stored in the database (I'm about to check to see if the PHP is even receiving it in the $_POST
variable, I'll post an update when I've done that).
It sounds like a problem with rich-text formatting or perhaps the encoding of what is pasted.
Does anyone know of a solution that we can apply to the PHP site to enforce that the text area only accept plain text (or automatically convert it) for IE?
Thanks!
Update: Sadly, I cannot reproduce the bug on IE 6, 7 or 8 using Outlook Express. Perhaps this is user error...I'll update with more info when I figure out what the actual problem is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当复制的某些符号是高位 ASCII 字符并且与您正在使用的编码不匹配时,可能会发生这种情况。确保页面、程序和数据库使用相同的编码(例如,全部使用 UTF-8 或您使用的任何编码)。在插入具有此类字符的数据时,我遇到了奇怪的问题(空字符串、实例截断等)。
但是,当然,首先要检查您是否确实将数据传输到您的程序中:)
This might happen when some symbols copied are high-ASCII characters, and there is a mismatch with encodings you are working with. Make sure the page, your program, and your database use the same encoding (e.g. all use UTF-8, or whatever you use). I've encountered weird problems (empty strings, cut-off at the instance, etc) with inserting data that has characters like these.
But of course, check that you're actually getting the data to your program in the fist place :)
尝试在从
$_POST
退出时调用strip_tags
。Try calling
strip_tags
when pulling out from$_POST
.