From 1306291c6cc1aa4fb35ac122b2b5cae89532a11a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 1 May 2014 16:33:25 +0200 Subject: [PATCH] Handle utf-8 properly Fixes errors like: Caught exception in engine "Wide character in syswrite at /nix/store/498lwsrn5kkdh1q8kn3vcpd3457w6m7a-hydra-perl-deps/lib/perl5/site_perl/5.16.3/Starman/Server.pm line 547." Note that these errors didn't happen if the database encoding was set to SQL_ASCII (which was the case for hydra.nixos.org, explaining why it didn't get these errors). However, now the encoding must be UTF8. To change it, do: update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'hydra'; --- release.nix | 1 + src/lib/Hydra.pm | 1 + src/lib/Hydra/View/TT.pm | 1 + 3 files changed, 3 insertions(+) diff --git a/release.nix b/release.nix index 6004c88d..ecc28d09 100644 --- a/release.nix +++ b/release.nix @@ -87,6 +87,7 @@ in rec { CatalystPluginSessionStateCookie CatalystPluginSessionStoreFastMmap CatalystPluginStackTrace + CatalystPluginUnicodeEncoding CatalystTraitForRequestProxyBase CatalystViewDownload CatalystViewJSON diff --git a/src/lib/Hydra.pm b/src/lib/Hydra.pm index 6bef5cd8..213cea21 100644 --- a/src/lib/Hydra.pm +++ b/src/lib/Hydra.pm @@ -8,6 +8,7 @@ use Hydra::Plugin; use Hydra::Model::DB; use Catalyst::Runtime '5.70'; use Catalyst qw/ConfigLoader + Unicode::Encoding Static::Simple StackTrace Authentication diff --git a/src/lib/Hydra/View/TT.pm b/src/lib/Hydra/View/TT.pm index 483b0250..2f9d4201 100644 --- a/src/lib/Hydra/View/TT.pm +++ b/src/lib/Hydra/View/TT.pm @@ -6,6 +6,7 @@ use Hydra::Helper::Nix; __PACKAGE__->config( TEMPLATE_EXTENSION => '.tt', + ENCODING => 'utf-8', PRE_CHOMP => 1, POST_CHOMP => 1, expose_methods => [qw/buildLogExists buildStepLogExists jobExists/]);