[html-formfu] unicode and yml?

Carl Franks fireartist at gmail.com
Mon Sep 24 13:39:39 GMT 2007


On 24/09/2007, Josef Chladek <josef.chladek at gmail.com> wrote:
>
> Am 24.09.2007 um 13:37 schrieb Carl Franks:
>
> > On 24/09/2007, Josef Chladek <josef.chladek at gmail.com> wrote:
> >> hello list,
> >>
> >> when I use the config from yml [1], my output is wrong, as soon as I
> >> put [% form %] in my tt (umlauts garbled).
> >> when I do the config in my Controller [2], everything's working.
> >> following the thread in
> >> http://lists.scsys.co.uk/pipermail/html-formfu/2007-August/
> >> 000190.html
> >> looked like that the yml/unicode problem was solved (I'm using
> >> YAML::Syck 0.97) - any chance on getting this working correctly with
> >> yml files?
> >
> > Are you saving the files as utf-8, or some iso variant?
> > If you're using utf-8, then it should work - I don't know about other
> > encodings though.
>
> yes, unicode everywhere - there are no umlauts in the yml file (nor
> the corresponding code in the controller), but the files are saved
> utf8 (textmate and vim say so) and the controller uses 'use utf8;'
>
> > When you tested with umlauts in the controller, did you "use utf8;"
> > in the file?
> > Because you should have needed to. If it appeared to work without
> > that, then something was still going wrong.
> >
> > FormFu sets the appropriate flags to make both YAML::Syck and TT
> > handle utf-8 correctly (see ObjectUtil.pm load_config_file() and
> > Render/base.pm xhtml() for details)
> > - so my first suggestion is to ensure your yaml + TT files are utf-8
> > encoded, and then, if you're viewing this in a browser, ensure you're
> > setting the page encoding, or if you're viewing this in a console,
> > make sure it can display unicode ok.
> >
> > The examples you sent didn't seem to have any umlauts in - was that
> > intended?
>
> yes, the umlauts are in the tt files and as soon as [% form %]
> appears they are broken.
> in the View::TT I use
>         DEFAULT_ENCODING    => 'UTF-8',
>
> I tried to comment out as much as possible in the formfu files: as
> soon as
> process_attrs(self.attrs)
> in start_form is processed, the umlauts are bad.
>
> with the controller code everything's working except that I can't get
> $c->stash->{form}->submitted
> what is needed to populate the form after a submit?

FormFu passes ('ENCODING' => 'UTF-8') to TT, but I can't see anything
about TT using a  DEFAULT_ENCODING setting.

Have you tried outputting the source to your console to check exactly
what's being output?
    $ script/myapp_test /

Other than that, I can't think of much else.
If you can replicate the problem with a minimal Catalyst application,
you could send that to the list.

Carl



More information about the HTML-FormFu mailing list