From dc140e66c821bafc42b03ee17072fc0de8ab718f Mon Sep 17 00:00:00 2001 From: rboren Date: Tue, 1 Feb 2005 08:31:13 +0000 Subject: [PATCH] Don't stomp the percent in escaped octets. git-svn-id: http://svn.automattic.com/wordpress/trunk@2189 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index a4e6b110d6..5f95f6cb2d 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -217,7 +217,13 @@ function sanitize_title($title, $fallback_title = '') { function sanitize_title_with_dashes($title) { $title = strip_tags($title); - $title = preg_replace('|%|', '', $title); + // Preserve escaped octets. + $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); + // Remove percent signs that are not part of an octet. + $title = str_replace('%', '', $title); + // Restore octets. + $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); + $title = remove_accents($title); if (seems_utf8($title)) { if (function_exists('mb_strtolower')) {