-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
RESTEasy adds wrong charset to response content type #25295
Comments
In our code this bug only started occurring when we switched to reactive RESTEasy. However, in the minimal reproducer it is also broken for classic RESTEasy. |
I don't consider this a bug TBH. If you need to set the content type, you can certainly do something like: httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, mediaType.getType() + "/" + mediaType.getSubtype() + ";charset=ISO-8859-1"); |
Please have a careful look at my example. Even if I don't explicitly set the content type it will be wrong! The message body writer uses ISO-8859-1 as encoding but still the HTTP |
I reworked my example so it does not use a message body writer any more and produces images. Still the returned content type has a |
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
Understood, thanks |
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295
Harmonize the usage of charset in the Content-Type headers for RESTEasy Reactive
…sy Reactive The idea is that we know only append it for specific response media types. Before this change, the charset was added depending on how the return type of the Resource method Relates to: quarkusio#25295 (cherry picked from commit 60aa2b7)
According to quarkus-qe/quarkus-test-suite#655 this issue has been fixed but it's still labelled with "invalid". If it's indeed fixed maybe someone can remove that label (and add a milestone). |
Good point, done |
Describe the bug
Consider the following code:
In contrast to #25263 this time a media type is passed into the message body writer, but it contains
charset=UTF-8
. Which can be wrong if the message body writer creates output using a different charset. If the message body writer sets the charset explicitly the content type contains two conflicting charset specifications.Expected behavior
The media type passed into the message body writer must not contain a charset because only the writer can tell what charset it produces.
Actual behavior
A UTF-8 charset is incorrectly assumed for every response.
How to Reproduce?
Run
quarkus.bugs.CharsetDuplicatedTest
from https://github.com/sithmein/bugs-in-quarkus.Output of
uname -a
orver
No response
Output of
java -version
17
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.8.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: