Skip to content

utf-8 by default #406

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

Closed
eduarddrenth opened this issue Jan 4, 2022 · 1 comment
Closed

utf-8 by default #406

eduarddrenth opened this issue Jan 4, 2022 · 1 comment
Milestone

Comments

@eduarddrenth
Copy link
Contributor

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

@oliemansm
Copy link
Member

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.

@oliemansm oliemansm added this to the 13.0.0 milestone Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants