I send request from nodejs to server, and in my url query cyrillic text like this: https://somesite.com/wf/server/postSomeStuff?id=13&name=Имя.pdf&other=true;
But server see Имя like A;>1>60=I8=0. (for example). And I want to make this query encode to unicode. I was trying to set headers like Accept-Charset or Accept-Encoding, but it's not helps.. how can I change encode only in url, not content?
Add a comment
|
1 Answer
you can use javascript encodeURI function before sending request for example
var url = 'https://somesite.com/wf/server/postSomeStuff?id=13&name='+encodeURI('Имя.pdf')+'&other=true';
and decode it on the server side var name = decodeURI(req.params.name);
2 Comments
YoroDiallo
Thx for your time and answer! I allready try this, but don't know it's good practice in codding? I think perhaps we have different way, like put something in header, or not?
Asif Saeed
there is nothing wrong in this practise but if you dont want to expose your contents like name and id then you should try other ways. Its possible to send data using headers but its better if you make post request instead of get