JavaScript reemplazar espacios con NBSP
str = str.replace(/\s/g, " ");
Friendly Hawk
str = str.replace(/\s/g, " ");