JavaScript menggantikan spasi dengan nbsp

str = str.replace(/\s/g, " ");
Friendly Hawk