diff --git a/include/php_setup.inc b/include/php_setup.inc
index 29f4ef362d0bc0e0e99513d8a1ee78d2cca14738..2bc9c961ef4905b3310070ec045e55d9a0cfa439 100644
--- a/include/php_setup.inc
+++ b/include/php_setup.inc
@@ -26,6 +26,22 @@
  */
 require_once ("variables.inc");
 
+/*!
+ * \brief Escape string for HTML output
+ */
+function htmlescape ($str)
+{
+  return htmlspecialchars($str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
+}
+
+/*!
+ * \brief Unescape string for HTML output, reverse of htmlescape
+ */
+function htmlunescape ($html)
+{
+  return html_entity_decode($html, ENT_QUOTES | ENT_HTML5, 'UTF-8');
+}
+
 function html_trace($errstr = "")
 {
   static $hideArgs = array(