visionmedia/express — pull request #1704 by PiusLT (2013-08-01 11:58:44+00:00)
Title: Added UTF-8 charset default to res.json method.

`res.json` malfunctioned when JSON contained UTF-8 characters. For example

res.json({ 'ąčęėįšųūž': 'ąčęėįšųūž' })

would be treated in Chrome like

{
"Ä…ÄÄ™Ä—Ä¯Å¡Å³Å«Å¾": "Ä…ÄÄ™Ä—Ä¯Å¡Å³Å«Å¾"
}

It can be fixed by setting charset BEFORE setting content type so that `Content-Type` header would be set to `application/json; charset=utf-8` instead of `application/json`. This is pretty much the same what `res.send` does with a string - `Content-Type` header also gets the UTF-8 charset: `text/html; charset=utf-8`.