[Dancer-users] Problem with PLACK

igor.bujna at post.cz igor.bujna at post.cz
Wed Jul 7 13:19:37 CEST 2010


Ok, its worked now. thank you.

> ------------ Původní zpráva ------------
> Od: Alex Kapranoff <kapranoff at gmail.com>
> Předmět: Re: [Dancer-users] Problem with PLACK
> Datum: 07.7.2010 08:37:52
> ----------------------------------------
> Hello, Igor!
> 
> I can repeat your problem using your directions. Looks like
> Plack::Middleware::Lint got enabled by default in development environments
> somewhere in April and together with Dancer::Template::TemplateToolkit it
> leads to your error.
> 
> There is a simple way to workaround the error. You may switch to
> Template::Simple by commenting out "template" setting in config.yml.
> 
> Proper fix would be to apply this patch to your Dancer:
> diff --git a/lib/Dancer/Template/TemplateToolkit.pm
> b/lib/Dancer/Template/Templa
> index 0e092db..4bdb717 100644
> --- a/lib/Dancer/Template/TemplateToolkit.pm
> +++ b/lib/Dancer/Template/TemplateToolkit.pm
> @@ -19,6 +19,7 @@ sub init {
>      my $tt_config = {
>          ANYCASE   => 1,
>          ABSOLUTE  => 1,
> +        ENCODING  => 'utf8',
>          %{$self->config},
>      };
> 
> And then specify "charset: utf8" in config.yml.
> 
> (to all: we should think about making charset: utf8 the default)
> 
> Igor, can you test it?
> 
> -- 
> Alex Kapranoff.
> 
> 2010/7/7 <igor.bujna at post.cz>
> 
> >
> > Hello,
> > I have problem, when starting my dancer aplication with plackup and in
> > template use UTF8 characters such as  "Čeština je pěkný jazyk".
> > When I start aplication via Dancer start skript and after render the page,
> > everything is ok. But when i start this via plackup and after render page i
> > get message "body must be bytes and should not contain wide characters
> > (UTF-8 strings)". This message is in file Plack/Middleware/Lint.pm in 'sub
> > validate_res()' where test is:
> >
> >    if (ref $res->[2] eq 'ARRAY' && grep utf8::is_utf8($_), @{$res->[2]}) {
> >        $croak->('body must be bytes and should not contain wide characters
> > (UTF-8 strings).');
> >    }
> >
> > When i comment this test the aplication, then run OK. I try this on
> > http://github.com/sukria/ThisShit, when i put in main layout my UTF8 text
> > "Čeština je pěkný jazyk".
> > I think this problem is with plack, which can't use UTF8 text for rendering
> > :(
> > _______________________________________________
> > Dancer-users mailing list
> > Dancer-users at perldancer.org
> > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
> >
> 
> 
> 


More information about the Dancer-users mailing list