utf-8 by default
eduarddrenth opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
Perhaps related to #392
For my applications and data I standardize on utf-8 as much as possible.
To make this work this using kickstart servlet I have to set character encoding
Describe the solution you'd like
Perhaps include this snippet in GraphQLHttpServlet:
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
try {
req.setCharacterEncoding(StandardCharsets.UTF_8.name());
resp.setCharacterEncoding(StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
super.doPost(req, resp);
}
or introduce some configuration for character encoding
For the response it already sets the character encoding:
For the request it takes the character encoding from the request, but if you haven't set that in the request then it'll revert to the default. For the multipart post requests it doesn't use the correct character encoding from the request as reported in #392 explains. Will address that one and will add something setting the character encoding of the request to UTF-8 if it hasn't been set to make sure it uses that as the default. That leaves room for making sure you can specify your own character encoding (UTF-16 or UTF-32) by specifying it in the request when you send it.