Encoding URI in connectHandlers


#1

Hej,

I have a simple app which handles redirections.

It works great except for special characters in the url. Can I set utf8 encoding?

Example Code:

Meteor.startup(() => {
  WebApp.connectHandlers.use((req, res, next) => {
      const exampleUrl = 'https://www.amazon.de/Rabe-Fuchs-Bartöl-kontrolliert-biologischem/dp/B074XGXFK4/ref=sr_1_1?ie=UTF8&qid=1507983673898&sr=8-1&keywords=bartöl';
      res.writeHead(301, {Location: exampleUrl});
      res.end();
  });
});

The redirect url would be https://www.amazon.de/Rabe-Fuchs-Bart�l-kontrolliert-biologischem/dp/B074XGXFK4/ref=sr_1_1?ie=UTF8&qid=1507983673898&sr=8-1&keywords=bart�l