-
Notifications
You must be signed in to change notification settings - Fork 117
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
(4.0.x) Response encoding not stored in the ext context session (possible spec violation?) #5543
Comments
I created a proposal PR here: #5542 |
https://www.w3schools.com/tags/ref_urlencode.asp : having a look at: |
@schluedo thinking about this more, I'm wondering though what practical effect this suggestion would have. As the traveling data are URL-encoded, the encoding used by the client becomes irrelevant. (URL-encode should be like "encode to UTF-8 and then escape reserved characters", so the result should be the same no matter what the original encoding was. That is why the "application/x-www-form-urlencoded" format doesn't have a "charset" parameter.) Also I think that modern browsers don't choose the encoding arbitrarily or based on user locale. They default to UTF-8, unless the web page specifies something different. If you had different tabs using different encodings, the application would have to cause it itself. Do you see such a problem in practice? |
@TomasHofman as far as I read it UTF-8 is a recommendation for URL-Encoding, but not a standard. I could image a scenario where applications provide different encodings in different views (e.g. different charsets for different user locales: /indexDE.xhtml and /indexCN.xhtml) |
Your reproducer is actually a no-repro in GlassFish 7 nor Tomcat 10. It appears this is because these servers by default use UTF-8 as request body encoding while WildFly by default uses ISO-8859-1. But you're right, this slipped through during the #5385 work. I've fixed it. Thank you for reporting the issue and the PR attempt! |
@BalusC what do you think about the encoding-per-view approach? |
@BalusC yes, I can confirm that setting the default encoding to UTF-8 is a working workaround in Wildfly. Thanks for fixing this the right way! :) |
@BalusC I guess it should also be up-ported to the 4.1 and main branches..? |
Fix Response encoding not stored in the ext context session #5543
Was just matter of upmerging. |
Describe the bug
Since Mojarra 4.0.6 (probably after this PR #5385), Mojarra doesn't store the response encoding into the external context session. Originally, this was performed by this line: https://github.com/eclipse-ee4j/mojarra/pull/5385/files#diff-b3a9aacd3be9aefe5ab7fe6e92c87862f999bff1c8523313a2c76451f5136422L1010
I think storing the response encoding is mandated by the spec "2.5.2.2. Determining the Character Encoding" (https://jakarta.ee/specifications/faces/4.0/jakarta-faces-4.0#determining-the-character-encoding), which mentions:
The result is that accented characters may not be correctly processed by Mojarra. It comes to a situation that in a scope of single session, even if previous responses were being generated and marked as UTF-8, subsequent request may still not be processed as UTF-8 and the request contents are mangled.
To Reproduce
Steps to reproduce the behavior:
wildlfy/standalone/deployments/
)./wildfly/bin/standalone.sh
)Expected behavior
The accented character is displayed correctly after form is submitted.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: