FAQ
Hi,

We are currently building an application using Catalyst framework and
have a lot of encoding problem. Since we use a lot on french
characters (like ?-?-?-?-?), we need to take care of the encoding of
Perl module and TT templates.

We have a running setup with Perl module in ISO-8859-1 (latin1) and
templates in UTF-8. That strange match works great under Apache using
mod_perl. All french characters are parse correctly even if they are
from templates, Perl code or MySQL db.

If we run the app. under Catalyst dev. server, everything goes
wrongs. We have a lot of "gremlins" instead of correct char. We are
unable to figure out what should be done to have correct output in all
case.

Our setup :

Apache charset : ISO-8859-1
In TT's view : ENCODING => 'ISO-8859-1'
All Perl and TT file save in : ISO-8859-1

Are we on the good way?

Dominic Germain
---------------------------------------------
Administrateur r?seau / Network administrator
Sogetel
www.sogetel.net

mailinglists@sogetel.com

Search Discussions

  • Bill Moseley at Oct 31, 2007 at 11:50 pm

    On Wed, Oct 31, 2007 at 05:04:28PM -0400, Dominic Germain wrote:
    We have a running setup with Perl module in ISO-8859-1 (latin1) and
    templates in UTF-8.
    In TT's view : ENCODING => 'ISO-8859-1'
    You are telling Template Toolkit that your templates are Latin1, but
    you say your templates are UTF-8.

    Then are you using 'Unicode::Encoding' plugin to generate UTF-8
    output?

    --
    Bill Moseley
    moseley@hank.org
  • Dami Laurent (PJ) at Nov 1, 2007 at 3:07 pm

    -----Message d'origine-----
    De : Dominic Germain
    Envoy? : mercredi, 31. octobre 2007 22:04
    ? : The elegant MVC web framework
    Objet : [Catalyst] Charset best practice

    Hi,

    We are currently building an application using Catalyst framework and
    have a lot of encoding problem. Since we use a lot on french
    characters (like ?-?-?-?-?), we need to take care of the encoding of
    Perl module and TT templates.

    We have a running setup with Perl module in ISO-8859-1 (latin1) and
    templates in UTF-8. That strange match works great under
    Apache using
    mod_perl. All french characters are parse correctly even if they are
    from templates, Perl code or MySQL db.

    If we run the app. under Catalyst dev. server, everything goes
    wrongs. We have a lot of "gremlins" instead of correct char. We are
    unable to figure out what should be done to have correct
    output in all
    case.

    Our setup :

    Apache charset : ISO-8859-1
    In TT's view : ENCODING => 'ISO-8859-1'
    All Perl and TT file save in : ISO-8859-1

    Are we on the good way?

    Dominic Germain
    ---------------------------------------------
    Administrateur r?seau / Network administrator
    Sogetel
    www.sogetel.net

    mailinglists@sogetel.com
    Salut Dominic,

    We also run a Catalyst app in french and iso-8859-1.

    Catalyst::View::TT is hardcoded in UTF8. So the trick is to define a subclass in which you override the process() method, and there you set $c->response->content_type('text/html; charset=iso-8859-1');

    Bonne chance, L. Dami
  • Dominic Germain at Nov 2, 2007 at 3:02 am
    Great! Overrinding the process method do the job!

    Merci beaucoup!

    Dominic Germain
    ---------------------------------------------
    Administrateur r?seau / Network administrator
    Sogetel
    www.sogetel.net

    mailinglists@sogetel.com



    On 07-11-01, at 11:07, Dami Laurent (PJ) wrote:

    -----Message d'origine-----
    De : Dominic Germain
    Envoy? : mercredi, 31. octobre 2007 22:04
    ? : The elegant MVC web framework
    Objet : [Catalyst] Charset best practice

    Hi,

    We are currently building an application using Catalyst framework and
    have a lot of encoding problem. Since we use a lot on french
    characters (like ?-?-?-?-?), we need to take care of the encoding of
    Perl module and TT templates.

    We have a running setup with Perl module in ISO-8859-1 (latin1) and
    templates in UTF-8. That strange match works great under
    Apache using
    mod_perl. All french characters are parse correctly even if they are
    from templates, Perl code or MySQL db.

    If we run the app. under Catalyst dev. server, everything goes
    wrongs. We have a lot of "gremlins" instead of correct char. We are
    unable to figure out what should be done to have correct
    output in all
    case.

    Our setup :

    Apache charset : ISO-8859-1
    In TT's view : ENCODING => 'ISO-8859-1'
    All Perl and TT file save in : ISO-8859-1

    Are we on the good way?

    Dominic Germain
    ---------------------------------------------
    Administrateur r?seau / Network administrator
    Sogetel
    www.sogetel.net

    mailinglists@sogetel.com
    Salut Dominic,

    We also run a Catalyst app in french and iso-8859-1.

    Catalyst::View::TT is hardcoded in UTF8. So the trick is to define a
    subclass in which you override the process() method, and there you
    set $c->response->content_type('text/html; charset=iso-8859-1');

    Bonne chance, L. Dami

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
    Dev site: http://dev.catalyst.perl.org/
  • Bill Moseley at Nov 2, 2007 at 3:33 pm

    On Thu, Nov 01, 2007 at 04:07:30PM +0100, Dami Laurent (PJ) wrote:
    We also run a Catalyst app in french and iso-8859-1.

    Catalyst::View::TT is hardcoded in UTF8. So the trick is to define a
    subclass in which you override the process() method, and there you
    set $c->response->content_type('text/html; charset=iso-8859-1');

    The OP said the templates were UTF-8.

    If the templates are UTF-8 then you (should) have

    TT::View's ENCODING => 'UTF-8';

    That will decode the UTF-8 templates into Perl's internal encoding.

    Setting the content type won't automatically encode the content,
    though. That's why the Encoding::Unicode plugin does this in
    finalize:

    $c->response->body( $c->encoding->encode( $c->response->body, $CHECK ) );

    That plugin also will decode all incoming parameters.


    --
    Bill Moseley
    moseley@hank.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedOct 31, '07 at 9:04p
activeNov 2, '07 at 3:33p
posts5
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase