From 2bf1d4b2e19579a84d61b1d05b398eacfcf50ce2 Mon Sep 17 00:00:00 2001 From: Buchan Milne Date: Tue, 15 Feb 2011 23:01:21 +0000 Subject: Fix display of non-ascii characters (may need some work in admin for multi-valued attributes) --- lib/CatDap/Controller/admin.pm | 11 ++++++++++- lib/CatDap/Controller/user.pm | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/CatDap/Controller/admin.pm b/lib/CatDap/Controller/admin.pm index 914b2d0..da609bb 100644 --- a/lib/CatDap/Controller/admin.pm +++ b/lib/CatDap/Controller/admin.pm @@ -143,7 +143,15 @@ sub account : Local { my $mesg = $c->model('user') ->search("(&(objectClass=inetOrgPerson)($attribute=$value))"); - my @entries = $mesg->entries; + my @orig_entries = $mesg->entries; + my @entries; + foreach my $entry (@orig_entries) { + my %new_entry; + foreach my $attr ($entry->attributes) { + $new_entry{$attr} = Encode::decode_utf8($entry->get_value($attr)); + } + push @entries, \%new_entry; + } push @errors, $mesg->error if $mesg->code; $c->stash( entries => \@entries ); $c->stash( errors => \@errors ); @@ -295,6 +303,7 @@ sub account_modify : Local { if grep /$attr/, @{ ${ $c->config }{'Controller::User'}{'skip_attrs'} }; my @vals = $entry->get_value($attr); + foreach (@vals) { $_ = Encode::decode_utf8( $_ ); } $attrdef = $schema->attribute($attr) or die("getting schema failed: $!"); my %valhash = ( diff --git a/lib/CatDap/Controller/user.pm b/lib/CatDap/Controller/user.pm index b3edb32..2d0ba04 100644 --- a/lib/CatDap/Controller/user.pm +++ b/lib/CatDap/Controller/user.pm @@ -202,6 +202,7 @@ sub index :Path :Args(0) { next if ($attr eq "objectClass"); next if grep /$attr/,@{${$c->config}{'Controller::User'}{'skip_attrs'}}; my @vals = $entry->get_value($attr); + foreach (@vals) { $_ = Encode::decode_utf8( $_ ); } $attrdef = $schema->attribute($attr) or die ("getting schema failed: $!"); my %valhash = ( name => $attr, -- cgit v1.2.1