1

I'm using Request module in my nodejs express app, and i need to pass in the querystring any accented character (Ex: josé) but when the other client gets the request it gets an unknown character (?).

If i pass the same url by browser or postman the client gets the correct accent character.

var request = require('request-promise');

var url = 'http://mypathtotheurl?var=josé';

const optionsStart = {
              url: url,
              method: "GET",
              encoding: "binary",
              headers: {
                "Content-type": "applcation/pdf"
              }
        };
      request(optionsStart).then(function(body, data) {
        //my logic working as expected except for show special chars
     }

With the browser or postman get the correct response, by request module gets unknow character

1 Answer 1

2

I found a quick solution enconding the url in the request method:

var url = 'http://mypathtotheurl?var=josé';

url = encodeURI(url)
Sign up to request clarification or add additional context in comments.

Comments

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.