From ab2946047cd08c6b66cbc57410fa8a99430530f6 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 3 Apr 2009 13:19:33 -0700 Subject: Only kill control and surrogates, leave UTF-8 formatting chars alone. --- lib/util.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index a43666fa5..11f0f297e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -581,10 +581,8 @@ function common_shorten_link($url, $reverse = false) function common_xml_safe_str($str) { - $xmlStr = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $str), ENT_NOQUOTES, 'UTF-8'); - - // Replace control, formatting, and surrogate characters with '*', ala Twitter - return preg_replace('/[\p{Cc}\p{Cf}\p{Cs}]/u', '*', $str); + // Neutralize control codes and surrogates + return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str); } function common_tag_link($tag) -- cgit v1.2.3-54-g00ecf