Change to save length without to collapse table cell
I'm sendi开发者_如何学运维ng e-mails about weekly food orders. This is practically means 1, 2 or 3 tables. I'm trying to eliminate any unnecessary HTML from source to save bandwidth. Now there's one thing remained:
It costs 6 bytes when the client hasn't ordered anything at a day.
When I change the
to a simple space it breaks my table.
Is there any effective solution to throw out the non-breaking space without to collapse my table cells?
Update:
Thanks for the answers all of them does what I want after all I should accept Joeri's answer because some e-mail clients (Mozilla Thunderbird, Windows for example) totally messed up with the solutions below.
The problem with doing this is that email clients vary greatly. When sending html emails you should always use things that most clients will understand. nbsp (non-breaking space) is such a thing. The css attribute will probably be unrecognised by quite some clients, and unicode will probably not be supported.
So I think in this case you're stuck with the nbsp.
About entering it direct: The entities (such as this one) exist because a lot of old systems only support 7 bit ascii. The nonbreaking space (codepoint 160) is beyond that. There's also a chance there you'll run into a system that doesn't support it, but I guess that has to do with the codepage they use.
You may try this, but it won't work in all browsers/e-mail clients:
<table style="empty-cells: show">
You can add the character, that is represented by
, literally. It's the Unicode codepoint U+00A0. Input methods:
- vi:
<C-k>NB
- Windows:
ALT+0160
- Wikipedia
Perl:
perl -i -n -p 's/ /\x{A0}/g' email.html
Although, as Joeri Hendrickx points out in his answer, entering characters beyond ASCII literally might lead to problems in all positions of the email toolchain, starting from the client of the sender (if you happen to use the HTML as a template for a, say, Outlook user) and ending at the receiver's inbox server and client, that process it.
I'd like to join Joeri in his advice to leave the
unchanged and live with the extra bytes. If you've got lots of them, try to refactor the HTML instead.
Alt+0160 produces a blank, non-breaking space character:
Try keeping the TABLE DATA with the   on the same line. trust me it works!
`
<tr>
<td width="50"> </td>
</tr>
`
精彩评论