You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Fiol BonnĂ­n <an...@gmail.com> on 2006/02/07 10:08:05 UTC

Ajax and UTF-8 not working

Hello,

I have made every possible attempt I can think of to make Ajax work in
a UTF-8 environment. It plainly does not.

I set form-encoding to UTF-8.

HTML serializer is configured as follows:
<map:serializer logger="sitemap.serializer.html" mime-type="text/html"
                      name="html4" pool-grow="4" pool-max="32" pool-min="4"
                      src="org.apache.cocoon.serialization.HTMLSerializer">
<doctype-public>-//W3C//DTD HTML 4.01 Transitional//EN</doctype-public>
<doctype-system>http://www.w3.org/TR/html4/loose.dtd</doctype-system>
<encoding>UTF-8</encoding>
</map:serializer>

The rest is done like in http://cocoon.apache.org/2.1/userdocs/ajax.html, i.e.

<ft:form-template ... ajax="true">

Use <ft:repeater> instead of <ft:repeater-widget>

<map:transform type="browser-update"/>
...
<map:select type="ajax-request">
    <map:when test="true">
      <map:serialize type="xml"/>
    </map:when>
    <map:otherwise>
      <map:serialize type="html4"/>
    </map:otherwise>
</map:select>


The first page comes out well, but as soon as an ajax update for the
repeater is received, all the accented characters go into a strange
thing, and on the second round-trip, they get converted to a plain
question mark "?". (Firefox browser)

Disabling Ajax (removing ajax="true") makes the form work perfectly.

I tried to change the serializer and try a
o.a.c.components.serializers.XHTMLSerializer, and after changing the
JVM default encoding to UTF-8, I got some javascript errors
complaining about &quot; in the middle of Javascript code.

I am sure at least Sylvain must have tested this thoroughly, so I
can't understand what is happening.

Any ideas?

--
Antonio