如何使用 HTML Tidy (PHP) 保留不间断空格?

发布于 2024-07-11 12:07:36 字数 372 浏览 7 评论 0原文

我刚刚注意到 tidy_repair_string() 正在从空元素中删除不间断空格,导致我的表格崩溃。 基本上我已经输入了:

 

和 HTML Tidy 正在将它们剥离出来:

<td> </td>

这可能是也可能不是某种 Unicode 中断,但无论如何它都会崩溃。 我见过的唯一与 &nbsp; 相关的选项是“quote-nbsp”,但似乎不是这样。 我认为无论如何它默认为打开。

如何保留不间断空格?

I've just noticed that tidy_repair_string() is removing my non-breaking spaces from empty elements causing my table to collapse. Basically I've put in:

<td> </td>

and HTML Tidy is stripping them out to:

<td> </td>

which may or may not be some Unicode break but either way it's collapsing. The only   related option I've seen is 'quote-nbsp' but that doesn't seem to be it. I think it defaults to on anyway.

How do I keep my non-breaking spaces?

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

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

发布评论

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

评论(3

万劫不复 2024-07-18 12:07:36

应用此样式,则无需将内容放入“空”单元格中:

td { 空单元格:显示; }

Apply this style, then you do not need to put content in the "empty" cells:

td { empty-cells: show; }

萌能量女王 2024-07-18 12:07:36

使用“裸”配置选项。

更多信息和解释请参见:http:// osdir.com/ml/web.html-tidy.user/2004-07/msg00005.html

use the "bare" config option.

more information and an explanation available here: http://osdir.com/ml/web.html-tidy.user/2004-07/msg00005.html

只为守护你 2024-07-18 12:07:36

您可以尝试以下操作:

$myString = str_replace(" ", "  ", $someText);

You could try the following:

$myString = str_replace(" ", "  ", $someText);

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