eclipse-ee4j / mojarra-jsf-extensions

Other
1 stars 3 forks source link

ENCODING Problem -> javax.faces.request.charset #88

Closed glassfishrobot closed 16 years ago

glassfishrobot commented 16 years ago

From the poster:

Date: Tue, 12 Jun 2007 08:35:15 +0200 From: Matthias Unverzagt matthias.unverzagt@enpasos.com Content-Type: text/plain; charset=ISO-8859-15; format=flowed Subject: ENCODING Problem -> javax.faces.request.charset

I have a typical foreigner problem: It's about encoding. I wrote a little VWP test application (on latest NB6, Glassfish V2): One page, one textfield and static text following Hong's simple ajax-zone example (http://blogs.sun.com/honglu/entry/walking_through_creating_a_simple). The idea is: You enter a character in the textfield, onkeydown you get an ajax request that is responsible for putting the entered character on the static text. However, I can not get the encoding work.

Switching on the NetBeans HTTP monitor I get

FIRST REQUEST OF THE PAGE before the request: javax.faces.request.charset = UTF-8 after the request: javax.faces.request.charset = UTF-8

FIRST AJAX BASED REQUEST before the request: javax.faces.request.charset = UTF-8 after the request: javax.faces.request.charset = ISO-8859-1

SUBSEQUENT AJAX REQUESTs before the request: javax.faces.request.charset = ISO-8859-1 after the request: javax.faces.request.charset = ISO-8859-1

Any help, especially short-term workarounds are very much appreciated.

Thank you,

Matthias

Environment

Operating System: All Platform: Macintosh

Affected Versions

[current]

glassfishrobot commented 5 years ago
glassfishrobot commented 16 years ago

@glassfishrobot Commented Reported by rogerk

glassfishrobot commented 16 years ago

@glassfishrobot Commented rogerk said: It appears that this problem only occurs in JSP. In Facelets, the problem does not occur.

glassfishrobot commented 16 years ago

@glassfishrobot Commented rogerk said: The problem appears to be in AsyncResponse class. Specifically in AsyncResponse.createAjaxResponseWriter method...

We use reflection to get the writer from the response object, but the character encoding has not been set. So it defaults to ISO-8859-1

Possible Fix:

1. get the last stored character encoding from the session (identified by the key: ViewHandler.CHARACTER_ENCODING_KEY) 2. set that character encoding in the response using reflection.

So now the character encoding will be set on the response object before we get the writer from it.

This fix appears to work.

glassfishrobot commented 16 years ago

@glassfishrobot Commented rogerk said: Created an attachment (id=23) Patch

glassfishrobot commented 16 years ago

@glassfishrobot Commented @edburns said: r=edburns, looks great!

glassfishrobot commented 16 years ago

@glassfishrobot Commented rogerk said: Checked in. Thanks for the second set of eyes on this one - Ryan.

glassfishrobot commented 16 years ago

@glassfishrobot Commented File: a.txt Attached By: rogerk

glassfishrobot commented 16 years ago

@glassfishrobot Commented Was assigned to jsf-extensions-issues

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JSF_EXTENSIONS-88

glassfishrobot commented 16 years ago

@glassfishrobot Commented Marked as fixed on Tuesday, February 19th 2008, 2:53:08 am