From c8cbd970905d07541188bc52bd70e1563b0418a4 Mon Sep 17 00:00:00 2001 From: Ben Shum Date: Fri, 17 Aug 2012 17:31:20 -0400 Subject: [PATCH] IRC Logs - Change from htmlentities to htmlspecialchars htmlentities() was doing a very poor job at rendering unicode characters in our IRC log pages. Changing over to htmlspecialchars() and defining "UTF-8" directly improves the rendering. Signed-off-by: Ben Shum --- irc_logs.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/irc_logs.php b/irc_logs.php index b1e0e95..a1be6ec 100755 --- a/irc_logs.php +++ b/irc_logs.php @@ -159,15 +159,15 @@ JAVASCRIPT; $raw_line = substr($raw_line, 2); } $line_user = ''; - $line = '' . htmlentities($raw_line) . ''; + $line = '' . htmlspecialchars($raw_line, ENT_QUOTES, "UTF-8") . ''; } elseif(preg_match('/^<([^>]*)> (.*)$/', $raw_line, $line_parts)) { - $line_user = '' . htmlentities($line_parts[1]) . ''; - $line = '' . htmlentities($line_parts[2]) . ''; + $line_user = '' . htmlspecialchars($line_parts[1], ENT_QUOTES, "UTF-8") . ''; + $line = '' . htmlspecialchars($line_parts[2], ENT_QUOTES, "UTF-8") . ''; } } else { $line_user = ''; $line_date = ''; - $line = '' . htmlentities($raw_line) . ''; + $line = '' . htmlspecialchars($raw_line, ENT_QUOTES, "UTF-8") . ''; } echo '#', $line_date, $line_user, $line, ''; } -- 2.11.0