I'm trying to send strings from my site to my Node.js server, but when they are received, for some reasons some characters are lost.
// Client:
microAjax("/foo?test="+encodeURI("this is ++ a test"), function callback(){});
// Server:
app.get('/foo',function(req,res){
console.log(req.param("test"));
});
Here, both "+" characters appear missing on the server.
try
encodeURIComponent
instead ofencodeURI
. That will give you%2B
for the plus signs which should work.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI