How to get UTF-8 in Node.js?

Hook into you response generator or create a middleware that does the following:

res.setHeader("Content-Type", "application/json; charset=utf-8");

Otherwise the browser displays the content in it's favorite encoding.

If this doesn't help you DB is probably in the wrong encoding.

For older node.js versions use:

res.header("Content-Type", "application/json; charset=utf-8");

I can't solve this problem with setting content type. I solved this problem with encode function.

res.cookie('someCookie', someCookie, {
  encode: c => c,
});

For more information: express cookie

ExpressJS version: 4.16.4