Reputation: 1
I am working on JBoss EAP 6.4.4.GA (AS 7.5.4.Final-redhat-4) with JSF 2.1 and primefaces 5.3.8.
Since the deployment of the lates version of my application there has been a problem with umlaut encoding in my forms.
Entering german umlauts in inputText field:
<p:inputText widgetVar="vornameVar" id="vornameInput" value="#{empfaengerBean.vorname}">
</p:inputText>
My first thought was, that there is an error in the new version. But unfortunately I found none. Furthermore, if I revert to the older version (which previously worked well) the error suddenly occured as well.
I tried to resolve the problem as described in JSF Form and German Umlauts without success.
I added file encoding system properties:
file.encoding = UTF-8
file.encoding.pkg = sun.io
sun.jnu.encoding = UTF-8
sun.io.unicode.encoding = UnicodeLittle
And the charset in the xhtml form.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
And I added a CharachterEncodingFilter:
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Unfortunately it did not reslove the error.
Request Headers:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:no-cache
Connection:keep-alive
Content-Length:942
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=FS0R99ApjnD0M667rZaNcwVT
Host:localhost:8080
Origin:http://localhost:8080
Pragma:no-cache
Referer:http://localhost:8080/faces/myform.xhtml?dswid=559
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Response Headers: Content-Type:text/html;charset=UTF-8 Date:Wed, 17 May 2017 07:37:17 GMT Server:Apache-Coyote/1.1 Transfer-Encoding:chunked X-UA-Compatible:IE=8; IE=Edge
Form Data:
layout:inhalt:empfaengerMask:vornameInput:ÖÄÖ
layout:inhalt:empfaengerMask:familiennameInput:öäö
layout:inhalt:empfaengerMask:geburtsdarumInput:
layout:inhalt:empfaengerMask:j_idt39_collapsed:false
layout:inhalt:empfaengerMask:saveAndBackButton:
javax.faces.ViewState:8922152724142018356:3520638725638532662
dspwid:559
Response:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<form id="layout:inhalt:empfaengerMask"
name="layout:inhalt:empfaengerMask" method="post"
action="/faces/myform.xhtml?dswid=559"
enctype="application/x-www-form-urlencoded">
<input type="hidden" name="layout:inhalt:empfaengerMask"
value="layout:inhalt:empfaengerMask" />
<table style="display: inline-block; float: left; text-align: left;">
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><label id="layout:inhalt:empfaengerMask:j_idt67"
class="ui-outputlabel"
for="layout:inhalt:empfaengerMask:vornameInput">Vorname</label></td>
<td><input id="layout:inhalt:empfaengerMask:vornameInput"
name="layout:inhalt:empfaengerMask:vornameInput" type="text"
value="ÃÃÃ" maxlength="80" /></td>
<td><label id="layout:inhalt:empfaengerMask:j_idt70"
class="ui-outputlabel"
for="layout:inhalt:empfaengerMask:familiennameInput">Familienname</label></td>
<td><input id="layout:inhalt:empfaengerMask:familiennameInput"
name="layout:inhalt:empfaengerMask:familiennameInput" type="text"
value="öäö" maxlength="80"
class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /></td>
</tr>
<tr>
<td><label id="layout:inhalt:empfaengerMask:j_idt73"
class="ui-outputlabel"
for="layout:inhalt:empfaengerMask:geburtsdarumInput">Geburtsdatum</label></td>
<td><input id="layout:inhalt:empfaengerMask:geburtsdarumInput"
name="layout:inhalt:empfaengerMask:geburtsdarumInput" type="text"
class="ui-inputfield ui-inputmask ui-widget ui-state-default ui-corner-all" /></td>
<td></td>
</tbody>
</table>
</td>
</tr>
</table>
</fieldset>
</div>
<input type="hidden"
id="layout:inhalt:empfaengerMask:j_idt39_collapsed"
name="layout:inhalt:empfaengerMask:j_idt39_collapsed" value="false" />
</fieldset>
<script id="layout:inhalt:empfaengerMask:j_idt39_s"
type="text/javascript">PrimeFaces.cw("Fieldset","widget_layout_inhalt_empfaengerMask_j_idt39",{id:"layout:inhalt:empfaengerMask:j_idt39",toggleable:true,collapsed:false,toggleSpeed:500});</script>
<br />
<p></p>
<span id="layout:inhalt:empfaengerMask:detailPanel">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</span></span>
<p></p>
<div id="layout:inhalt:empfaengerMask:aktionleiste"
class="ui-widget-content layout_appaktionsleiste">
<div class="layout_appaktionsleiste_content">
<button id="layout:inhalt:empfaengerMask:j_idt120"
name="layout:inhalt:empfaengerMask:j_idt120"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
onclick="PrimeFaces.addSubmitParam('layout:inhalt:empfaengerMask',{'disableValidation':'null'})"
style="float: left" type="submit">
<span class="ui-button-text ui-c">Abbrechen</span>
</button>
<script id="layout:inhalt:empfaengerMask:j_idt120_s"
type="text/javascript">PrimeFaces.cw("CommandButton","widget_layout_inhalt_empfaengerMask_j_idt120",{id:"layout:inhalt:empfaengerMask:j_idt120"});</script>
<button id="layout:inhalt:empfaengerMask:saveAndBackButton"
name="layout:inhalt:empfaengerMask:saveAndBackButton"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
onclick="" type="submit">
<span class="ui-button-text ui-c">Speichern und zurück</span>
</button>
<script id="layout:inhalt:empfaengerMask:saveAndBackButton_s"
type="text/javascript">PrimeFaces.cw("CommandButton","saveAndBackButtonVar",{id:"layout:inhalt:empfaengerMask:saveAndBackButton"});</script>
<script id="layout:inhalt:empfaengerMask:j_idt122_s"
type="text/javascript">$(function(){PrimeFaces.cw("DefaultCommand","widget_layout_inhalt_empfaengerMask_j_idt122",{id:"layout:inhalt:empfaengerMask:j_idt122",target:"layout:inhalt:empfaengerMask:saveAndBackButton"});});</script>
</div>
</div>
<div style="clear: both;"></div>
<span id="layout:inhalt:empfaengerMask:wizInit"> <script
type="text/javascript">
var arDialog = null;
mainInitWiz();
</script></span><input type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState"
value="8922152724142018356:-5232436045222872752" autocomplete="off" />
</form>
</html>
I dont't know what I missed so far.
Upvotes: 0
Views: 653
Reputation: 1
I Just found the reason for the broken encoding. For debugging reasons I added a RequestDumperValve to log HTTP request headers in my JBoss config.
<valve name="RequestLogging" module="org.jboss.as.web" class-name="org.apache.catalina.valves.RequestDumperValve"/>
But, as described by https://rolfje.wordpress.com/2008/07/20/tomcat-utf-8-and-the-requestdumpervalve/, the RequestDumperValve does not only dump the request but also messes up the parsing of other-than-ISO-8859-1 incoming parameters.
Upvotes: 0