Merge pull request #306 from towards-a-new-leftypol/code-markup-encoding

Prevent double-encoding of HTML entities in [code]
This commit is contained in:
nonmakina 2021-07-11 11:04:23 +02:00 committed by GitHub
commit 780c64e31e

View file

@ -2196,8 +2196,8 @@ function markup(&$body, $track_cites = false, $op = false) {
$code = rtrim(ltrim($code, "\r\n"));
$code = "<pre class='code lang-$code_lang'>".str_replace(array("\n","\t"), array("&#10;","&#9;"), htmlspecialchars($code))."</pre>";
$code = "<pre class='code lang-$code_lang'>".str_replace(array("\n","\t"), array("&#10;","&#9;"), htmlspecialchars($code, ENT_COMPAT, "UTF-8", false))."</pre>";
$body = str_replace("<code $id>", $code, $body);
}
}