使用JavaScript函数encodeURI / escape和encodeURIComponent时似乎存在一个错误 . 例:
escape( 'The Frames' ) // The 0.000000rames
encodeURI( 'The Frames' ) // The 0.000000rames
encodeURIComponent( 'The Frames' ) // The 0.000000rames
评论显示输出 . 在任何浏览器中按照预期的方式在Spotify之外执行此代码(用%或%20替换空格) .
其他人可以证实这是一个错误吗?或者我在这里做错了什么......?有没有地方报告Spotify应用程序的错误?
EDIT: 显然上面的例子按预期工作 . 但是,将它们合并到alert()中会显示混乱的字符串,而实际上它是可以的 .
1 回答
来自guidelines:
getElementById('song-title').innerHTML = track.title.decodeForHTML(); getElementById('song-title').innerText = track.title.decodeForText(); getElementById('song-title').appendChild(document.createTextNode(track.title.decodeForText()));
和源代码,以防你好奇: