On Mon, March 26, 2007 6:54 am, Arno Kuhl wrote: > I've just noticed that "\r\n" and "\t" characters create a space when > rendered in the browser (tested in IE and Firefox). I'd always thought > the > browser would ignore these characters. No. HTML "collapses" any run of whitespace to a single space character. It does something akin to: $html = preg_replace("|\\s+|", " ", $html); on each chunk of non-tag content. It does not ever "ignore" whitespace in content. > This wouldn't normally be a > problem > but the wysiwyg html editor in the cms I'm using tries to be friendly > by > formatting the html code, so something like > > <span style=\"COLOR: #af0e14\">get</span><span style=\"COLOR: > #333333\">online</span> > > becomes > > \r\n\t\t<span style=\"COLOR: #af0e14\">get</span>\r\n\t\t<span > style=\"COLOR: #333333\">online</span> Your WYSIWIG tool is very broken, if the above is correct, since it is ADDING a bunch of whitespace inside the content. > Is there a simple way to sort this out or do I need to create a > function to > strip these characters before display, checking first that they don't > occur > within a <pre> tag in which case I mustn't strip them. I'm betting that you have not correctly analyzed what is going on yet, first and foremost. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php