diff --git a/advagg.module b/advagg.module
index b9dddf1..f20455f 100644
--- a/advagg.module
+++ b/advagg.module
@@ -625,7 +625,7 @@ function advagg_processor(&$variables) {
       'js_after' => $js_code,
     );
     $data['runtime'] = isset($_advagg['debug']) ? $_advagg['debug'] : FALSE;
-    $data = str_replace('    ', '&nbsp;&nbsp;&nbsp;&nbsp;', nl2br(htmlentities(print_r($data, TRUE))));
+    $data = str_replace('    ', '&nbsp;&nbsp;&nbsp;&nbsp;', nl2br(htmlentities(iconv('utf-8','utf-8//IGNORE', print_r($data, TRUE)), ENT_QUOTES, 'UTF-8')));
     watchdog('advagg', 'Debug info: !data', array('!data' => $data), WATCHDOG_DEBUG);
   }
 }
