Don't stomp the percent in escaped octets.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2005-02-01 08:31:13 +00:00
parent 7f77b54e16
commit dc140e66c8
1 changed files with 7 additions and 1 deletions

View File

@ -217,7 +217,13 @@ function sanitize_title($title, $fallback_title = '') {
function sanitize_title_with_dashes($title) { function sanitize_title_with_dashes($title) {
$title = strip_tags($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); $title = remove_accents($title);
if (seems_utf8($title)) { if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) { if (function_exists('mb_strtolower')) {