0

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?

1 Answer 1

1

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);

Sign up to request clarification or add additional context in comments.

2 Comments

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?
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.