From a37b646a671e6d9189b42fbe36263ef3d08ad9ce Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Sat, 22 May 2004 14:34:09 +0000 Subject: [PATCH] new remove_accents for sanitize_title, not relying on the file's charset git-svn-id: http://svn.automattic.com/wordpress/trunk@1345 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 3e5448c43..277920c2a 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -78,6 +78,47 @@ function wpautop($pee, $br = 1) { return $pee; } + +function seems_utf8($Str) { # by bmorel at ssi dot fr + for ($i=0; $i 'OE', chr(197).chr(147) => 'oe', chr(197).chr(160) => 'S', chr(197).chr(189) => 'Z', chr(197).chr(161) => 's', chr(197).chr(190) => 'z', chr(226).chr(130).chr(172) => 'E'); + $string = utf8_decode(strtr($string, $invalid_latin_chars)); + } + $string = strtr($string, $chars['in'], $chars['out']); + $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); + $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); + $string = str_replace($double_chars['in'], $double_chars['out'], $string); + return $string; +} + function sanitize_title($title) { $title = do_action('sanitize_title', $title); @@ -85,6 +126,7 @@ function sanitize_title($title) { } function sanitize_title_with_dashes($title) { + $title = remove_accents($title); $title = strtolower($title); $title = preg_replace('/&.+?;/', '', $title); // kill entities $title = preg_replace('/[^a-z0-9 _-]/', '', $title);