There seems to be a bug when using the JavaScript functions encodeURI / escape and encodeURIComponent. Example:
escape( 'The Frames' ) // The 0.000000rames
encodeURI( 'The Frames' ) // The 0.000000rames
encodeURIComponent( 'The Frames' ) // The 0.000000rames
The comments show the output. Executing this code outside of Spotify in whatever browser works as expected (replacing a space by either + or %20).
Can others confirm this is a bug? Or am I doing something wrong here…? Is there a place to report bugs for Spotify Apps?
EDIT: Apparently the examples above work as they are supposed to. However, incorporating them in an alert() will show a messed up string, while in fact it is OK.
From the guidelines:
getElementById('song-title').innerHTML = track.title.decodeForHTML();
getElementById('song-title').innerText = track.title.decodeForText();
getElementById('song-title').appendChild(document.createTextNode(track.title.decodeForText()));
And the source code, in case you’re curious: