diff --git a/lib/AccountManager/Tools.pm b/lib/AccountManager/Tools.pm
index 56209f464088c02025d7b763c58a8733c0c98abf..c5a59601b01640388dab03a5524dbc7fbc36cb24 100644
--- a/lib/AccountManager/Tools.pm
+++ b/lib/AccountManager/Tools.pm
@@ -95,14 +95,16 @@ sub update_ssp_authsources {
     my ($templates_dir, $output, $accounts) = @_;
 
     my $tt2 = Template->new({
-        INCLUDE_PATH => $templates_dir
+        ENCODING     => 'utf8',
+        INCLUDE_PATH => $templates_dir . '/accounts'
     });
-    my $template = 'accounts/accounts.php.tt2';
+    my $template = 'accounts.php.tt2';
     my $data = {
         accounts  => $accounts,
     };
 
-    $tt2->process($template, $data, $output) or die $tt2->error();
+    $tt2->process($template, $data, $output, { binmode => ':utf8' })
+        or die $tt2->error();
 }
 
 1;