NodeJS decodeURIComponent not working properly

家住魔仙堡 提交于 2019-12-04 09:28:18

I cannot reproduce it in 0.10 or 0.11 versions of node.

You can convert first to second using new Buffer('Ulysses Guimarães - lado par', 'binary').toString('utf8'), but it's a workaround, not a solution.

Are you sure you're calling decodeURI, not unescape?

I'm just leaving this here, because I had the same problem. I was using the encodeURIcomponent(str) function in the client and in Nodejs when I did decodeURI(str) had the same problem. I solved it by using encodeURI(str) at the client.

Use var querystring = require("querystring");

The querystring.unescape() method performs decoding of URL percent-encoded characters on the given str.

and then querystring.unescape(str) as per docs:

https://nodejs.org/api/querystring.html#querystring_querystring_unescape_str

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!