How to keep my non-breaking spaces with HTML Tidy (PHP)?
Question
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?
Solution
Apply this style, then you do not need to put content in the "empty" cells:
td { empty-cells: show; }
OTHER TIPS
use the "bare" config option.
more information and an explanation available here: http://osdir.com/ml/web.html-tidy.user/2004-07/msg00005.html
You could try the following:
$myString = str_replace(" ", " ", $someText);