diff --git a/include/class.api.php b/include/class.api.php
index 23ae8a589e9192a08394134929ff9429695b2f30..fff9c2dd3d5798dcc88e0f2985bb5127c55e4ab6 100644
--- a/include/class.api.php
+++ b/include/class.api.php
@@ -337,7 +337,7 @@ class ApiXmlDataParser extends XmlDataParser {
                 if (isset($value['encoding']))
                     $value['body'] = Format::utf8encode($value['body'], $value['encoding']);
                 if (!isset($value['type']) || $value['type'] != 'text/html')
-                    $value = sprintf('<div style="white-space:pre-wrap">%s</div>',
+                    $value = sprintf('<pre>%s</pre>',
                         Format::htmlchars($value['body']));
                 else
                     $value = $value['body'];
@@ -381,7 +381,7 @@ class ApiJsonDataParser extends JsonDataParser {
                 // Allow message specified in RFC 2397 format
                 $data = Format::parseRfc2397($value, 'utf-8');
                 if (!isset($data['type']) || $data['type'] != 'text/html')
-                    $value = sprintf('<div style="white-space:pre-wrap">%s</div>',
+                    $value = sprintf('<pre>%s</pre>',
                         Format::htmlchars($data['data']));
                 else
                     $value = $data['data'];