Apparently this is how HTML works. It collapses multiple spaces into one space until you specifically tell him otherwise.
For example let's say you have a string like “my string with multiple spaces”. If you try to set this string to the innerHTML property of a div element like below;
myDiv.innerHTML = “my string with multiple spaces”;
Then myDiv will display your string as “my string with multiple spaces” collapsing multiple spaces.
mystring = “my string with multiple spaces”;
mystring = mystring.replace(/ /g, “u00A0”);
After doing the above replacement you are good to go…
And you have all your spaces in place and visible.
Hope this helps someone.