Hello,

I finally had some time to investigate this issue further and also to figure 
out the problem. The encoding issue is being caused by the Tobgao FileUpload 
(tc:file) component:

Here is the XHTML page structure:

main.xhtml:

<ui:composition xmlns:f="http://java.sun.com/jsf/core"; 
xmlns:tc="http://myfaces.apache.org/tobago/component"; 
xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns="http://www.w3.org/1999/xhtml";>

        <f:view locale="#{facesContext.viewRoot.locale}" encoding="UTF-8">
                <tc:page id="page">
                        <tc:flexLayout columns="270px;*" id="mainframe">
                                <tc:flexLayout rows="auto;*">
                                        <tc:box id="content">
                                                <ui:insert/>
                                        </tc:box>
                                </tc:flexLayout>
                        </tc:flexLayout>
                </tc:page>
        </f:view>
</ui:composition>

encodingtest.xhtml:

<ui:composition
        template="/pages/tobago/main.xhtml"
        xmlns:f="http://java.sun.com/jsf/core";
        xmlns:h="http://java.sun.com/jsf/html";
        xmlns:tc="http://myfaces.apache.org/tobago/component";
        xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns="http://www.w3.org/1999/xhtml";>

        <ui:param
                name="controller"
                value="#{encodingTestBean}" />

        <tc:section label="SECTION">

                <tc:file
                        label="TEST"
                        value="#{controller.file}" />

                <tc:textarea
                        label="TEXT"
                        value="#{controller.text}"
                        rows="5">
                        <f:validateLength
                                minimum="1"
                                maximum="254" />
                </tc:textarea>
        </tc:section>

        <tc:flexLayout>
                <tc:panel>
                        <tc:button
                                image="fa-floppy-o"
                                action="#{controller.save}"
                                label="SAVE" />
                        <tc:button
                                image="fa-floppy-o"
                                action="#{controller.upload}"
                                label="UPLOAD" />
                </tc:panel>
        </tc:flexLayout>
</ui:composition>

Bean:

@ManagedBean
@RequestScoped
public class EncodingTestBean {

        private String text;

        private transient Part file;

        public String save() {
                for (Entry<String, String> entry : 
FacesContext.getCurrentInstance().getExternalContext()
                                .getRequestParameterMap().entrySet()) {
                        System.out.println(entry.getKey() + ": " + 
entry.getValue());
                }
                return null;
        }

        public void upload() {
                // foo bar
        }

        public String getText() {
                return text;
        }

        public void setText(String text) {
                this.text = text;
        }

        public Part getFile() {
                return file;
        }

        public void setFile(Part file) {
                this.file = file;
        }
}

If I visit encodingtest.xhtml and enter some text into the text area like: 
"üöüäüöüüä", the text gets changed to something like: "äüäüüüäü". If 
you remove the tc:file component, everything works fine.

Thank you for your help.


Kind regards,

Marko

-----Ursprüngliche Nachricht-----
Von: Voß, Marko <marko.v...@cgi.com>
Gesendet: Montag, 28. Mai 2018 10:07
An: MyFaces Discussion <users@myfaces.apache.org>
Betreff: AW: Fwd: Tobago 3.0.6 - Encoding problems with tc:textarea etc in 
tc:tabGroup

Hello Udo,

thank you for your fast response. I will get back to this issue asap so please 
be patient with me. Thank you.

Kind regards,

Marko

-----Ursprüngliche Nachricht-----
Von: Udo Schnurpfeil <udo.schnurpf...@irian.eu<mailto:udo.schnurpf...@irian.eu>>
Gesendet: Mittwoch, 23. Mai 2018 17:28
An: MyFaces Discussion 
<users@myfaces.apache.org<mailto:users@myfaces.apache.org>>
Betreff: Re: Fwd: Tobago 3.0.6 - Encoding problems with tc:textarea etc in 
tc:tabGroup

Hi Marko,

I can't reproduce the issue until now (no WAS 8.0 available).

I've a running example with WAS 8.5.5.13, this might help you to find the error.

Here's what I've tested:

Starting WAS 8.5.5.13 via Docker (see
https://hub.docker.com/r/ibmcom/websphere-traditional/)

$ echo "test1234">PASSWORD
$ docker run --name test -h test -v $(pwd)/PASSWORD:/tmp/PASSWORD -p
9043:9043 -p 9443:9443 -d ibmcom/websphere-traditional:8.5.5.13-profile

Browse to https://localhost:9043/ibm/console/ and use wsadmin/test1234 to login.

Checkout my example (slightly modified Tobago 3.0.7-SNAPSHOT demo):

$ git clone https://github.com/lofwyr14/myfaces-tobago.git test $ cd test $ git 
checkout test-websphere-umlauts $ mvn

Deploy tobago-example/tobago-example-demo/target/tobago-example-demo.war
into WAS e.g. on context path /demo

Check these URLs (different switchType):

https://localhost:9443/demo/faces/content/20-component/070-tab/00-client/tab-client.xhtml
https://localhost:9443/demo/faces/content/20-component/070-tab/01-ajax/tab-ajax.xhtml
https://localhost:9443/demo/faces/content/20-component/070-tab/02-server/tab-server.xhtml

If this is running for you, you may test to deploy the tobago-example-demo.war 
in your 8.0 WAS.

Or you may test to deploy your application into the docker 8.5 WAS.

Hope that helps

Regards,

Udo

Am 23.05.18 um 15:35 schrieb Henning Nöth:
> FYI
>
>
> -------- Weitergeleitete Nachricht --------
> Betreff: Tobago 3.0.6 - Encoding problems with tc:textarea etc in
> tc:tabGroup
> Datum: Wed, 23 May 2018 12:54:18 +0000
> Von: Voß, Marko <marko.v...@cgi.com<mailto:marko.v...@cgi.com>>
> Antwort an: MyFaces Discussion 
> <users@myfaces.apache.org<mailto:users@myfaces.apache.org>>
> An: users@myfaces.apache.org<mailto:users@myfaces.apache.org> 
> <users@myfaces.apache.org<mailto:users@myfaces.apache.org>>
>
> Hello,
>
> we are using Tobago 3.0.6 as we have to support WebSphere 8.0.
>
> We experience some issues. One of them is that we get encoding issues
> when sending german umlauts and other special characters as values of
> tc:textArea or tc:selectManyCheckbox as child components of tc:tabGroup.
> I validated this issue and figured out, that the encoding issues are
> already present in
> facesContext.getExternalContext().getRequestParameterMap().
>
> For example: Having the text "Örtlichkeit" as a value of a tc:textArea
> component with id "test" results in a key-value-pair:
>
> test=örtlichkeit
>
> The encoding of the HTML document in the browser is displayed
> correctly as UTF-8.
>
> Please help.
>
> Kind regards,
>
> Marko Voß
>

--
Dipl.-Math. Udo Schnurpfeil - Managing Director IRIAN Deutschland GmbH - 
Poststr. 1-3 - 26122 Oldenburg - Germany mobile +49 174 9784746 - fax +49 441 
99922161 mailto:udo.schnurpf...@irian.eu - http://www.irian.eu/

Reply via email to