From aa3340e58fc5b993bfc88070edf543a2ed82ef94 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 27 Sep 2012 03:32:46 +0200 Subject: Fixing unicode. --- lib/Fripost/Panel/Interface.pm | 19 +++++++++++-------- lib/Fripost/Panel/Login.pm | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'lib/Fripost/Panel') diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm index db6752e..f150a39 100644 --- a/lib/Fripost/Panel/Interface.pm +++ b/lib/Fripost/Panel/Interface.pm @@ -12,10 +12,12 @@ Interface.pm - =cut use parent 'Fripost::Panel::Login'; + use Fripost::Schema; use Fripost::Password; use HTML::Entities; -use Net::IDN::Encode qw/email_to_unicode/; +use Net::IDN::Encode qw/email_to_unicode domain_to_ascii/; +use CGI::Util qw/escape unescape/; # This method is called right before the 'setup' method below. It @@ -117,7 +119,9 @@ sub ListLocals : Runmode { $template->param( listAliases => $#aliases >= 0 || $domain{permissions} =~ /[aop]/ ); $template->param( aliases => [ - map { { alias => encode_entities($_->{alias}) + map { my $a = escape(encode_entities($_->{alias})); # TODO + { aliasurl => escape($a) + , alias => $a , description => join ("\n", @{$_->{description}}) , isactive => $_->{isactive} , destinations => [ map { {destination => encode_entities($_)} } @@ -139,7 +143,7 @@ sub ListLocals : Runmode { , description => join ("\n", @{$_->{description}}) , isactive => $_->{isactive} , transport => $_->{transport} - , listurl => $CFG{'listurl_'.$_->{transport}}.$_->{list}.'@'.$d + , listurl => $CFG{'listurl_'.$_->{transport}}.$_->{list}.'@'.domain_to_ascii($d) }; } @lists @@ -189,7 +193,7 @@ sub EditDomain : Runmode { $template->param( isactive => $q->param('isactive') , description => $q->param('description') , catchalls => $q->param('catchalls') - , error => encode_entities ($error, "‘‘") ); + , error => encode_entities ($error) ); } else { $template->param( isactive => $domain{isactive} @@ -267,8 +271,7 @@ sub EditLocal : Runmode { $q->param('oldpw'), ldap_uri => $CFG{ldap_uri}, ldap_suffix => $CFG{ldap_suffix}, - -die => "Wrong password (for ‘" - .encode_entities($u)."‘)." ); + -die => "Wrong password (for ‘".$u."’)." ); }; $error = $@ || $fp->mailbox->passwd( $entry{user}, @@ -336,7 +339,7 @@ sub EditLocal : Runmode { my $news = (defined $q->param('submit') or (defined $q->param('a') and $q->param('a') eq 'delete')); $template->param( newChanges => $news ); - $template->param( error => encode_entities ($error, "‘‘") ) if $error; + $template->param( error => encode_entities ($error) ) if $error; $template->param( canDelete => 1 ) if $t eq 'alias'; # TODO $template->param( listurl => $CFG{'listurl_'.$local{transport}}.$l.'@'.$d ) if $t eq 'list'; @@ -445,7 +448,7 @@ sub AddLocal : Runmode { } $template->param( isactive => $q->param('isactive') , description => $q->param('description') - , error => encode_entities ($error, "‘‘") ); + , error => encode_entities ($error) ); } else { $template->param( isactive => 1 ); diff --git a/lib/Fripost/Panel/Login.pm b/lib/Fripost/Panel/Login.pm index 8132310..86b3e66 100644 --- a/lib/Fripost/Panel/Login.pm +++ b/lib/Fripost/Panel/Login.pm @@ -208,7 +208,7 @@ sub error_rm : ErrorRunmode { $mesg = 'Not Found' } $template->param( code => $error ); - $template->param( message => encode_entities ($mesg, "‘‘") ); + $template->param( message => encode_entities ($mesg) ); return $template->output; } -- cgit v1.2.3