Answer the question
In order to leave comments, you need to log in
How to fix non-standard characters in node js?
My get requests to search for something do not go away if, for example, I write like this: server/required_item?param1=abcd#2 343¶m2=%873467
At the same time, I understand that it is unlikely that I will have such records in the database at all. BUT still I want to foresee everything, while such parameters in put / post work as they should
.update({_id: req.params.id}, req.body , function(err,object){
if (err) res.json({"update":err});
res.json({"update":"yeaah!!"});
})
.find(req.query,function(err,object){
if(object){
res.json(object);
}
else {
res.json({"object":"notFound"});
}
});
сервер/необходимый_итем?парам1=КрасивоИмя Без Инородных символов&парам2=и ТУут
Answer the question
In order to leave comments, you need to log in
Well, for starters, everything after the lattice is considered an anchor and does not stupidly go to the server. So if you have directly such requests as you have given, then that's why it does not work.
In general, you just need to do encodeURIComponent on the client, and the server itself will do the decodeURIComponent. If the user manually types crap in the address bar, then he is SSZB.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question