Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON / JSONP responses should default to UTF-8 #632

Closed
dshaw opened this issue Apr 19, 2011 · 3 comments
Closed

JSON / JSONP responses should default to UTF-8 #632

dshaw opened this issue Apr 19, 2011 · 3 comments

Comments

@dshaw
Copy link
Contributor

dshaw commented Apr 19, 2011

Behavior should be the same as HTML, defaults or not. Adding res.charset on every repsonse is a PITA. Setting something like app.set('charset', 'utf-8') might be nice.

@dshaw
Copy link
Contributor Author

dshaw commented Apr 19, 2011

The only issue I can see with app.set('charset') is that it's kind of duplication of effort with app.set('view options', { charset: 'UTF-8' });

@tj tj closed this as completed in 8f054db Apr 20, 2011
@tj tj closed this as completed in 3afbcd0 Apr 20, 2011
@mytharcher
Copy link

Here still happens not correctly. When I use res.json(data) or res.type('json') even res.header('Content-Type', 'application/json'), the output content (Chinese words) are all in wrong encoding which should be expected in UTF-8 by default.

When I set res.header('Content-Type', 'application/json; charset=utf-8'), then everything goes well.

So I think this is still a problem.

BTW, I am using 3.0.6 now.

@jonathanong
Copy link
Member

@mytharcher do you mind testing the latest express 4.x rc?

@expressjs expressjs locked and limited conversation to collaborators Mar 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants