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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)