tags:

views:

906

answers:

3

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>&nbsp;</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 &nbsp; 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?

A: 

You could try the following:

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

Epitaph
+2  A: 

use the "bare" config option.

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

sjstrutt
+12  A: 

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

td { empty-cells: show; }

Sparr
If i remember correctly, you're supposed to put that on the table, not the cell.
Kris
http://www.w3.org/TR/CSS2/tables.html#empty-cellsApplies to table-cell elements. You typically see it applied to a row or table and inheritance takes care of the rest, but it can be applied to single cells (or, more commonly, to styles applied to single cells).
Sparr
Learned something new today. :)
Jacco