[Catalyst] Catalyst and unicode: broken or I'm dumb?

Alex Povolotsky tarkhil at over.ru
Mon Feb 24 16:40:24 GMT 2014


On 02/24/14 20:29, Alex Povolotsky wrote:

You dumbass missed use utf-8; in EVERY of your modules.

EVERY means EVERY, not just Kukso.

> Hello
>
> I cannot get VERY simple code with UTF-8 to work.
>
> Let's see
>
> === cut Kukso.pm ===
> use utf-8;
> use Catalyst
> qw/
> +CatalystX::SimpleLogin
> Authentication
> Session
> Session::State::Cookie
> Session::Store::FastMmap
> ConfigLoader
> Static::Simple
> Unicode::Encoding
> /;
> === cut ===
>
> === cut HTML.pm ===
> package Kukso::View::HTML;
>
> use strict;
> use base 'Catalyst::View::TT';
>
> __PACKAGE__->config({
> INCLUDE_PATH => [
> Kukso->path_to( 'root', 'src' ),
> Kukso->path_to( 'root', 'lib' )
> ],
> PRE_PROCESS => 'config/main',
> WRAPPER => 'site/wrapper',
> ERROR => 'error.tt2',
> TIMER => 0,
> render_die => 1,
> TEMPLATE_EXTENSION => '.tt2',
> ENCODING => 'utf-8',
> });
>
> === cut ===
>
> === cut Root.pm ===
> sub index :Path :Args(0) {
> my ( $self, $c ) = @_;
> $c->log->info("Что за нафиг?");
> $c->stash->{title} = "Список аккаунтов";
> }
> === cut ===
>
> I'm getting proper UTF-8 output in $c->log, but...
>
> HTTP/1.0 200 OK
> Date: Mon, 24 Feb 2014 16:19:20 GMT
> Server: HTTP::Server::PSGI
> Content-Length: 631
> Content-Type: text/html; charset=utf-8
> X-Catalyst: 5.90053
>
> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <link rel="stylesheet" href="http://0:3000/static/css/main.css" 
> type="text/css" />
> <title>Список аккаунтов</title>
> </html>
> <body>
> <div id="header"><!-- BEGIN site/header -->
> <h1 class="title">Список аккаунтов</h1>
> <!-- END site/header -->
> </div>
>
> garbled unicode in HTML output.
>
> I've checked everything - but either something has changed and is not 
> reflected in manuals yet or I've overlooked some simple thing.
>
> Alex
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: 
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list