java-express
java-express copied to clipboard
There is no way to specify the charset of a response
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 charsets.getBytes()
If the current behavior is a bug, please provide the steps to reproduce. Specifyresponse.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.
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.