diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-04-03 13:19:33 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-04-03 13:19:33 -0700 |
commit | ab2946047cd08c6b66cbc57410fa8a99430530f6 (patch) | |
tree | 65f80dc61c48a415138ae21daa4f27389830008a | |
parent | b4c273113cc5d16dfa1ea3236dd8c78d1169cbf3 (diff) |
Only kill control and surrogates, leave UTF-8 formatting chars alone.
-rw-r--r-- | lib/util.php | 6 |
1 files changed, 2 insertions, 4 deletions
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) |