decodeURIComponent manglespath

当我将以下内容发布到节点(简化示例)时:

var xhr = new XMLHttpRequest(); xhr.open("POST", "http://localhost:3000/action"); xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xhr.send(JSON.stringify({path:encodeURIComponent("E:\foo\bar.baz")})); 

node.js代码:

 app.post('/action', function (request, response) { var file = request.body['path']; console.log(file); console.log(decodeURIComponent(file)); }); 

我得到以下输出:

 E%3A%0Coo%08ar.baz E:♀oar.baz 

我如何正确解码?

       

网上收集的解决方案 "decodeURIComponent manglespath"