[Catalyst] TT and UNICODE: Garbled special characters
Stefan Kühn
ducdebreme at early-dance.de
Wed Sep 5 09:27:31 GMT 2007
Hi Tobias
i tried both of it, but still got the same result.
NEXT TRY:
* i saved the controller test.pm in UTF-8 encoding,
* adapted the broken character ...
* called the url
* and it worked!
QUESTION: Catalyst generates Perl files in the computer's standard
encoding (which is cp1252). For *unicode best practice* it should be
in UTF-8 encoded. Do you agree?
Thanks
Stefan
On 9/5/07, Tobias Kremer <list at funkreich.de> wrote:
> Quoting Stefan Kühn <ducdebreme at early-dance.de>:
> > * In controller test.pm > added the following (note the German Umlaut)
> > sub index : Private {
> > my ( $self, $c ) = @_;
> > $c->stash->{myname} = 'düc'; # <-- **NOTE** the German Umlaut
> > $c->stash->{template} = 'test.tt2';
> > }
>
> If you use special characters as string literals you have to "use utf8" at the
> top of your controller.
>
> Other than that you should tell TT that your templates are UTF-8 encoded by
> passing it a configuration option in your View class:
>
> __PACKAGE__->config( {
> ...
> ENCODING => 'utf-8',
> ...
> } );
--
More information about the Catalyst
mailing list