[Catalyst] Help needed with Unicode

Mario Minati mario.minati at googlemail.com
Tue Mar 20 21:34:03 GMT 2007


Am Dienstag 20 März 2007 20:03 schrieben Sie:
> Am Dienstag 20 März 2007 19:12 schrieb Renaud Drousies:
> > > Am Dienstag 20 März 2007 17:07 schrieb Renaud Drousies:
> > >> > (The formdata is submitted through ajax/xmlhttprequest, is that a
> > >> > possible source for that problem?)
> > >>
> > >> That was for me.
> > >>
> > >> Which request headers are you sending when doing the ajax call?
> > >> If you are not doing so yet, try using
> > >> "application/x-www-form-urlencoded;
> > >> charset=UTF-8".
> > >
> > > Firebug says:
> > >
> > > -- request header --
> > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > > Content-Type: application/x-www-form-urlencoded
> > >
> > > -- response header --
> > > Content-Type: text/html; charset=utf-8
> > > X-Catalyst: 5.7006
> > >
> > > For me that looks ok.
> > > Or do I need a charset=utf-8 in the _header_?
> >
> > I'd still explicitely set the request character set. If you don't do so,
> > it will be handled with the default character set of your server.
> > (correct me if i'm wrong)
>
> I played a little with the FF2 settings and changed the coding to utf-8 and
> guess what, suddently it work as it should be.
>
> So I think you might be right I have to force charset even in the request
> header, but I don't know yet how to achieve that in Dojo, but I'll find
> out.
>
> I'll post my results, stay tuned.

Finally I figured out howto set the header with dojo to request a specific 
charset. For those who are interested:

        var x = new dojo.io.FormBind({
            headers: { 'accept-charset': 'utf-8'},
            // reference the form
            formNode: dojo.byId('[% form.id %]'),
            preventCache: true,
            load: function(load, data, e) {
            // what to do when the form finishes
            // for example, populate a DIV:
                dojo.byId("[% form.id %]").disable=false;
                _container_.setContent(data);
            },
            error: function(type, err) {
                dojo.debug("Error during FormBind:" + err.message);
            }
        });

After defineing the accept-charset header the form setting still worked when 
changing the FF2 setting to an other encoding.

:D

Greets,
Mario Minati



More information about the Catalyst mailing list