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

There is no way to specify the charset of a response #21

Open
jalberto-ghub opened this issue Jan 11, 2021 · 1 comment
Open

There is no way to specify the charset of a response #21

jalberto-ghub opened this issue Jan 11, 2021 · 1 comment

Comments

@jalberto-ghub
Copy link

Using latest version: 0.2.1

Do you want to request a feature or report a bug?
This should really be a bug, but may be thought of as a feature.
What is the current behavior?
response.send(String s) always uses the default charset s.getBytes()
If the current behavior is a bug, please provide the steps to reproduce.
Specify response.setContentType("text/plain; charset=UTF-8");
What is the expected behavior?
That the String is sent using UTF-8 encoding, but the string is sent using the default charset of the javaVM
Please mention your java and java-express version.
0.2.1

Ideally there should be a method on the response for setting the charset and that charset then be used by send. Additionally calling response.contentType(String) should check whether a charset is specified and set it accordingly.

@masecla22
Copy link

This is addressed in my fork of this project. It is able to determine the charset to use by looking at the content type header.

https://github.com/masecla22/java-express
If you want to take a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants