You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by schneidc <si...@gmx.de> on 2010/03/22 16:37:22 UTC

[TRINIDAD] Issue with Trinidad's javascript and UTF-8

Hi,

some days ago I made a posting about a problem with umlauts. I the meantime
I made some progress in fixing the issue (at least sort of) and decided to
start a new topic as in my eyes this is a different case.

The problem with the umlauts or UTF-8 is caused by the javascript when using
PPR. If I disable PPR, enter the text "Böhm" in an input field, the actual
POST message contains "B%C3%B6mh", the UTF-8 encoding of "ö". When I enable
PPR, the transmitted value is actually "Böhm" , so no UTF-8 encoding here
and the server doesn't know how to handle it.

I wrote a little javascript function which replaces "ö" with the
corresponding encodings so that the transmitted string looks like "Böhm"
and voila, the according string on the server side does indeed contain the
value "Böhm".

So my guess is, that the javascript library which comes with Trinidad
doesn't recognize, that the page encoding is set to UTF-8 and therefore
sends the string as entered in the input box and doesn't do any conversion
where neccessary. Is this a bug? Or am I missing something?


Cheers Simon
-- 
View this message in context: http://old.nabble.com/-TRINIDAD--Issue-with-Trinidad%27s-javascript-and-UTF-8-tp27988154p27988154.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: AW: [TRINIDAD] Issue with Trinidad's javascript and UTF-8

Posted by schneidc <si...@gmx.de>.
Hi Tobias,

I just made an interesting observation. I changed the the first line of one
page from <?xml version="1.0" encoding="UTF-8"?> to <?xml version="1.0"
encoding="ISO-8859-1"?> (btw I'm using Facelets instead of JSP) and removed
my javascript function which converted "Böhm" to "Böhm".

Now, the POST-Message contains "Böhm", but nevertheless on server side the
umlauts are missing. Now I feel a little helpless why's that, in the end the
server get's the same data...

Kind regards
Simon
-- 
View this message in context: http://old.nabble.com/-TRINIDAD--Issue-with-Trinidad%27s-javascript-and-UTF-8-tp27988154p27997140.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


AW: [TRINIDAD] Issue with Trinidad's javascript and UTF-8

Posted by Eisenträger, Tobias <To...@arag.de>.
Hello Simon,

 

I also had problems getting the umlauts to work. Here is what I did. This might not be a very clean way of doing it, but this configuration finally worked for me. I will mark the things I think are important in yellow (sorry for the html formatting).

 

A standard page:

 

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

 

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:tr="http://myfaces.apache.org/trinidad"

      xmlns:t="http://myfaces.apache.org/tomahawk"

      xmlns="http://www.w3.org/1999/xhtml" version="2.0"

      xmlns:c="http://java.sun.com/jsp/jstl/core"

      >

      <jsp:directive.page contentType="text/html;charset=utf-8" />

      <ui:composition template="WEB-INF/inc-templates/main-template.jspx">

          <!-- params for page titles-->

          <ui:param name="pageTitle" value="Arbeitskorb" /> <!--  Erscheint im title tag -->

          <ui:param name="contentHeader" value="Arbeitskorb"/>     <!--  Erscheint ueber Menu -->

          <ui:define name="content">

          

              <ui:decorate template="WEB-INF/inc-templates/content-template.jspx" >

 

                        <ui:define name="pageContent" >    

                              Insert Page Content here.

                        </ui:define>

 

                  </ui:decorate>

          </ui:define>

      </ui:composition>

</jsp:root>

 

 

The main template:

 

<tr:document xmlns:jsp="http://java.sun.com/JSP/Page"

      xmlns:c="http://java.sun.com/jsp/jstl/core"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:tr="http://myfaces.apache.org/trinidad"

      xmlns:t="http://myfaces.apache.org/tomahawk"

      xmlns="http://www.w3.org/1999/xhtml"

      title="#{pageTitle}"

      styleClass="start"

      >     

      <f:facet name="metaContainer">       

            <meta http-equiv="Content-Language" content="de" />

            <meta name="keywords" content="Keywords here" />

      <meta name="description" content="Description here" />

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

      <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />   

   </f:facet> 

                                                     

      <div id="wrap">

 

                        <ui:insert name="content">Seite existiert nicht.<br/>

            <a href="login.arag" class="link" onclick="Mask.show('#{SessionBean1.BLOCKING_PAGE_DIV}')">Login</a>

</ui:insert>

 

      </div>

      

      

</tr:document>

 

The content template:

 

<div xmlns="http://www.w3.org/1999/xhtml"

     xmlns:f="http://java.sun.com/jsf/core"

     xmlns:ui="http://java.sun.com/jsf/facelets"

     xmlns:tr="http://myfaces.apache.org/trinidad" >

     <f:view>

           <tr:form defaultCommand="submitButton"  >

                  <ui:insert name="pageContent"/>

           </tr:form>

     </f:view>

     <span class="pic_le_top"><span></span></span>

</div>

 

 

 

Mit freundlichen Grüßen 

 

 

 

Tobias Eisenträger

 

 

 

Softwareentwickler

 

Dokumentenmanagement/Workflow/Internet, AKB 8125 

 

 

 

ARAG IT GmbH

ARAG Platz 1, 40472 Düsseldorf

 

Tel.: +49 (0)211 964-1937

 

tobias.eisentraeger@arag.de

www.ARAG.de

 

 

 

Aufsichtsratsvorsitzender:

 

Gerd Peskes

 

Vorstand:

 

Dr. Paul-Otto Faßbender (Vors.),

 

Dr. Jan-Peter Horst,

 

Dr. Johannes Kathan, Werner Nicoll,

 

Hanno Petersen, Dr. Joerg Schwarze

 

Sitz und Registergericht:

 

Düsseldorf, HRB 1371

 

USt-ID-Nr.: DE 119 355 995

 

 

> -----Ursprüngliche Nachricht-----

> Von: schneidc [mailto:simon.work@gmx.de]

> Gesendet: Montag, 22. März 2010 16:37

> An: users@myfaces.apache.org

> Betreff: [TRINIDAD] Issue with Trinidad's javascript and UTF-8

> 

> 

> Hi,

> 

> some days ago I made a posting about a problem with umlauts. I the

> meantime

> I made some progress in fixing the issue (at least sort of) and decided to

> start a new topic as in my eyes this is a different case.

> 

> The problem with the umlauts or UTF-8 is caused by the javascript when

> using

> PPR. If I disable PPR, enter the text "Böhm" in an input field, the actual

> POST message contains "B%C3%B6mh", the UTF-8 encoding of "ö". When I

> enable

> PPR, the transmitted value is actually "Böhm" , so no UTF-8 encoding here

> and the server doesn't know how to handle it.

> 

> I wrote a little javascript function which replaces "ö" with the

> corresponding encodings so that the transmitted string looks like "Böhm"

> and voila, the according string on the server side does indeed contain the

> value "Böhm".

> 

> So my guess is, that the javascript library which comes with Trinidad

> doesn't recognize, that the page encoding is set to UTF-8 and therefore

> sends the string as entered in the input box and doesn't do any conversion

> where neccessary. Is this a bug? Or am I missing something?

> 

> 

> Cheers Simon

> --

> View this message in context: http://old.nabble.com/-TRINIDAD--Issue-with-

> Trinidad%27s-javascript-and-UTF-8-tp27988154p27988154.html

> Sent from the MyFaces - Users mailing list archive at Nabble.com.