PHP htmlentities 引用问题

发布于 2024-12-11 02:07:14 字数 403 浏览 7 评论 0原文

我很高兴使用重新编码直接输入 SQL 数据库的现有数据库数据,而无需使用 htmlentities。这也是一个法语网站。

我现在尝试将其输出到浏览器,并且通过使用 htmlentities() 所有法语字符都显示良好,但是未编码的 ' 和 ' 给我带来了问题。

我尝试显示的文本的一个示例是:

The ‘Maison de Maître’ is very...

以及显示它的代码

$p_title = htmlentities(stripslashes($pr['title']), ENT_QUOTES);

这不起作用 - 我还尝试使用 UTF-8 作为字符集,这会完全停止标题显示。

任何帮助将不胜感激!

I have the joy of using recoding existing database data that has been entered directly into the SQL database without having htmlentities used. It is also a french website.

I am now trying to output this to the browser and all of the french characters are appearing fine through using htmlentities(), however the unecoded ’ and ‘ are giving me problems.

An example of the text I am trying to display is:

The ‘Maison de Maître’ is very...

And the code to display it

$p_title = htmlentities(stripslashes($pr['title']), ENT_QUOTES);

This does not work - I have also tried using UTF-8 as the charset which stops the title showing at all.

Any help would be much appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耳根太软 2024-12-18 02:07:14

你可以试试这个。它适用于这个特定问题,但我不知道它是否能满足您的所有需要​​。

$p_title = htmlspecialchars(stripslashes($pr['title']), ENT_QUOTES);

You could try this. It works for this specific problem, but I don't know if it does all that you need.

$p_title = htmlspecialchars(stripslashes($pr['title']), ENT_QUOTES);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文