Firefox and Chrome seem to give different results with window.getSelection().toString() especially in conjunction with the encodeURI() method. Select any of the "non-break space" in bold below to get an alert with the string and its encoded counterpart.

non-breaking space? Let's try UTF non-breaking space in decimal or non-breaking space in hex?

Bug report on Firefox

    Browser testing results for encoding non-break space

  1. %20 : Firefox 50.1.0 on Ubuntu, IE 11.576.14373.0 on Windows 10, Microsoft Edge 38.14393.0.0 Microsoft EdgeHTML 14.14393 on Windows 10, Firefox 50.0.2 on Windows 10,
  2. %C2%A0 : Chrome 55.0.2883.87 on Ubuntu, Google Chrome 55.0.2883.87 m on Windows 10, Opera 41.0.2353.69 on Windows 10,