误用 导致长英文字符串不换行

从网上下载过一个UBB的转换成HTML的函数(c#),内中就有这么一句:
str  =  str.Replace( "   " , "   " );
看起来没什么问题," "在HTML中就是空格的意思啊,没什么可疑的地方。这样的代码在处理中文的时候也没什么问题,唯独在处理英文的时候,出现了网上广为流传的“长英文字符串不换行”问题,我查阅了网上流传的各种版本的文章,解决办法也是五花八门,各有不同,WOAD-BREAK,CSS,Javascript等等,我也曾经按图索骥,在国外的英文网站中查找上述方法的痕迹,奇怪的是,竟然一无所获。这一点让我大惑不解,郁闷了很长时间。
就在今天,就在刚才,当我第N次研究这个问题的时候,百无聊赖的我第一次察看起我的网站生成的HTML代码:
< DIV  style ="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE: 14px; FLOAT: right; PADDING-BOTTOM: 0px; MARGIN: 5px 0px 15px; VERTICAL-ALIGN: top; WIDTH: 475px; PADDING-TOP: 0px; TEXT-ALIGN: left
"
> Enter &nbsp; a &nbsp; search &nbsp; and &nbsp; the &nbsp; closest &nbsp; matches &nbsp; will &nbsp; start &nbsp; to &nbsp; appear &nbsp; as &nbsp; you &nbsp; type &nbsp; by &nbsp; quote, &nbsp; author &nbsp; and &nbsp; tag.QuoteView, &nbsp; rate &nbsp; and &nbsp; collect &nbsp; quotes. &nbsp; Learn &nbsp; the &nbsp; history &nbsp; and &nbsp; context &nbsp; of &nbsp; a &nbsp; famous &nbsp; quote &nbsp; or &nbsp; add &nbsp; your &nbsp; own &nbsp; knowledge &nbsp; about &nbsp; a &nbsp; quote.Author &nbsp; Find &nbsp; quotes &nbsp; by &nbsp; person. &nbsp; Learn &nbsp; or &nbsp; share &nbsp; a &nbsp; little &nbsp; bit &nbsp; about &nbsp; an &nbsp; author &nbsp; via &nbsp; their &nbsp; mini &nbsp; bio.TagsSearch &nbsp; using &nbsp; keywords &nbsp; (called &nbsp; Tags) &nbsp; that &nbsp; members &nbsp; have &nbsp; tagged &nbsp; quotes &nbsp; and &nbsp; authors &nbsp; with. &nbsp; Search &nbsp; all &nbsp; tags &nbsp; or &nbsp; just &nbsp; the &nbsp; tags &nbsp; you &nbsp; have &nbsp; submitted.CommunitySign &nbsp; up &nbsp; for &nbsp; our &nbsp; free &nbsp; membership &nbsp; and &nbsp; start &nbsp; tagging, &nbsp; submitting, &nbsp; rating &nbsp; and &nbsp; collecting &nbsp; quotes &nbsp; as &nbsp; a &nbsp; member &nbsp; of &nbsp; our &nbsp; community. </ DIV >

大量的&nbsp;强烈的刺激了我的神经,难道是&nbsp;搞得鬼?回想起研究过的几个英文网站,似乎并没有这么多&nbsp;啊?于是我尝试将所有的&nbsp;换成空格,保存,重新打开页面,IE窗口底部长长的滚动条消失了,问题奇迹般的解决了!!!
至此,尽管问题解决了,但是我并没有搞清楚为什么会出现这样的问题,没办法,只好祭出google大杀器。
感谢神圣和伟大的google,他无私的为我搜索到的下面资料,汇总一下,给同样出现“长英文字符串不换行”问题的朋友参考,或许您的问题并没有其他文章所说的那么复杂。
&nbsp;的全名是none-break space,意思是非断行空白、或者连续空白。
跟普通的空格相比,是两个不同的字符,其unicode码各不相同,标准HTML忽略连续2个以上空格,只显示一个,此外&nbsp;作为html所定义的一个实体,不能在xml中使用。
道理是浅显的,错误是隐蔽的,教训是惨痛的。