diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 3cd78eeaece..718b95687b9 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -194,7 +194,9 @@ function dol_escape_js($stringtoescape) function dol_escape_htmltag($stringtoescape) { // escape quotes and backslashes, newlines, etc. - return strtr($stringtoescape, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',""=>'',''=>'')); + $tmp=@html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8'); + $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',""=>'',''=>'')); + return @htmlentities($tmp,ENT_COMPAT,'UTF-8'); }