Skip to content
Browse files
bug 1063 fixed: avoid error when adding a tag in chinese or russian c…

In any language where the str2url would return an empty string. The behavior
doesn't change for european characters.

rvelices warned me about the many issues we might encounter with copy/paste of
the URL and required url_encode/url_decode BUT after many tests (Linux with
Firefox 3.0/Google Chrome 5, MacOS 10.6 with Firefox/Safari, WindowsXP with
IE6/Firefox) I've found 0 problem, even with the most error prone mode
$conf['tag_url_style'] = 'tag'

git-svn-id: 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed May 3, 2010
1 parent 1f01b7f commit 0ce0f28a2306d442b8fd3781ef20524c995d7027
Showing 1 changed file with 7 additions and 0 deletions.
@@ -381,11 +381,18 @@ function remove_accents($string)
function str2url($str)
$raw = $str;

$str = remove_accents($str);
$str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str));
$str = preg_replace('/[\s\'\:\/\[\],-]+/',' ',trim($str));
$res = str_replace(' ','_',$str);

if (empty($res))
$res = $raw;

return $res;

0 comments on commit 0ce0f28

Please sign in to comment.