Changeset 6060


Ignore:
Timestamp:
05/04/10 01:31:42 (9 years ago)
Author:
plg
Message:

bug 1063 fixed: avoid error when adding a tag in chinese or russian characters.
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
$conftag_url_style = 'tag'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r6025 r6060  
    382382function str2url($str) 
    383383{ 
     384  $raw = $str; 
     385   
    384386  $str = remove_accents($str); 
    385387  $str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str)); 
    386388  $str = preg_replace('/[\s\'\:\/\[\],-]+/',' ',trim($str)); 
    387389  $res = str_replace(' ','_',$str); 
     390 
     391  if (empty($res)) 
     392  { 
     393    $res = $raw; 
     394  } 
    388395 
    389396  return $res; 
Note: See TracChangeset for help on using the changeset viewer.