diff --git a/doku.php b/doku.php
index 36aece4308736a8900b9e0d79e2afe9bd64a8fa0..e25ce324aaa2dd831c9f8d8991eb4c9297a75bdd 100644
--- a/doku.php
+++ b/doku.php
@@ -41,7 +41,6 @@
   if(empty($ID))  $ID  = $conf['start'];
   if(empty($ACT)) $ACT = 'show';
 
-  header('Content-Type: text/html; charset='.$lang['encoding']);
 
   if($ACT == 'debug'){
     html_debug();
@@ -117,6 +116,7 @@
   }
 
   //start output
+  header('Content-Type: text/html; charset='.$lang['encoding']);
   if(substr($ACT,0,6) != 'export') html_header();
   if(html_acl($permneed)){
     if($ACT == 'edit'){