Originally Posted by kovidgoyal
Another idea, replace the nbsp with
<span style="white-space:pre"> </span>
A little more semantic, though much longer.
As you probably know, French make a really extensive use of nbsp. This is part of their typographic rules. Personally I would not care if it was written in code view in a numeric (#160) or lettered (nbsp) form but I would certainly never follow your proposal, even if the end result was visually about the same in book view.
The proposed code above is way too long and awkward. We use regex to insert nbsp or their numeric equivalents, and I am pretty sure none (pun not intended) in France would ever consider this.