[Catalyst] Charset best practice

Dami Laurent (PJ) laurent.dami at justice.ge.ch
Thu Nov 1 15:07:30 GMT 2007


>-----Message d'origine-----
>De : Dominic Germain [mailto:mailinglists at sogetel.com] 
>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 at 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



More information about the Catalyst mailing list