JBOSS EAP德国变音符号编码坏了

时间:2017-05-17 08:07:18

标签: jsf encoding primefaces jboss

我正在使用JSF 2.1和primefaces 5.3.8开发JBoss EAP 6.4.4.GA(AS 7.5.4.Final-redhat-4)。

由于我的应用程序的lates版本的部署,我的表单中的变音符号编码存在问题。

在inputText字段中输入德语变音符号:
enter image description here

提交表格后:
enter image description here

        <p:inputText widgetVar="vornameVar" id="vornameInput"   value="#{empfaengerBean.vorname}">
        </p:inputText>

我的第一个想法是,新版本中存在错误。但不幸的是我找不到。此外,如果我恢复到旧版本(之前运行良好),错误也会突然发生。

我尝试按JSF Form and German Umlauts中所述解决问题但没有成功。

我添加了文件编码系统属性:

file.encoding = UTF-8
file.encoding.pkg = sun.io
sun.jnu.encoding = UTF-8
sun.io.unicode.encoding = UnicodeLittle

以xhtml形式的字符集。

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

我添加了一个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>

不幸的是它没有重新发现错误。

请求标题:

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

响应标题:     内容类型:文本/ HTML;字符集= UTF-8     日期:2017年5月17日星期三07:37:17 GMT     服务器:Apache-狼/ 1.1     传输编码:分块     X-UA-兼容:IE = 8; IE =边缘

表格数据:

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

响应:

<?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>

我不知道到目前为止我错过了什么。

1 个答案:

答案 0 :(得分:0)

我刚刚找到了编码损坏的原因。 出于调试原因,我添加了一个RequestDumperValve来记录JBoss配置中的HTTP请求头。

    <valve name="RequestLogging" module="org.jboss.as.web" class-name="org.apache.catalina.valves.RequestDumperValve"/>

但是,正如https://rolfje.wordpress.com/2008/07/20/tomcat-utf-8-and-the-requestdumpervalve/所描述的那样,RequestDumperValve不仅会转储请求,还会混淆解析其他ISO-8859-1传入参数。