Results 1 to 5 of 5

Thread: Special characters creating bad URLs

  1. #1
    Join Date
    Aug 2008
    Location
    Paris, France
    Posts
    46

    Question Special characters creating bad URLs

    Hi,

    I tried to migrate over 2.3 and everything worked fine excepted for the following.

    I use ISO-8859-1 and the whole text displays OK.
    But when the title of a category, an article or a tag contains a special character, the URL rewriting transforms this character into a %2E or %20 and so on.

    How can I solve this (ie : that the URL rewriting transforms e acute into e, e grave into e, a grave into a, and so on) ?

    Thanks in advance
    Gus

  2. #2
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    342

    Default

    1. go to /lib/ directory

    2. find misc.lib.php file and open it in the text editor which allows you to write it in iso-8859-1 !!

    3. find the code (this is SEOReplace function):

    Code:
     // replace special chars
        $seo_replacement_str_arr = array (
          ' ','-','/','\\',',','.','#',':',';','\'','"','[',']','{','}',
          ')','(','|','`','~','!','@','%','$','^','&','*','=','?','+');
          
        $string = str_replace($seo_replacement_str_arr, '-', $string);
       
        $string = str_replace(GetWesternUTF('s'), 's', $string);
        $string = str_replace(GetWesternUTF('g'), 'g', $string);
    4. change to:

    Code:
     // replace special chars
        $seo_replacement_str_arr = array (
          ' ','-','/','\\',',','.','#',':',';','\'','"','[',']','{','}',
          ')','(','|','`','~','!','@','%','$','^','&','*','=','?','+');
          
        $string = str_replace($seo_replacement_str_arr, '-', $string);
       
    	 $string = str_replace('ą', 'a', $string);
    	 $string = str_replace('ę', 'e', $string);
    	
    ...
    ...
    ...
    ...
    
    	 $string = str_replace('Ą', 'A', $string);
    	 $string = str_replace('Ę', 'E', $string);
    	 
        $string = str_replace(GetWesternUTF('s'), 's', $string);
        $string = str_replace(GetWesternUTF('g'), 'g', $string);

    5. save that file in the code you want (i.e. iso-8859-2)

    little explanation:

    $string = str_replace('x', 'y', $string);

    x - first letter in your language
    y - second letter which will be displayed

  3. #3
    Join Date
    Aug 2008
    Location
    Paris, France
    Posts
    46

    Smile Thanks Linksor, I'll try this

    I already had a look at that function, but could not understand where the error was lying.

    If you are right, this shows that transcoding is a bit more difficult than imagined by the coders ...

  4. #4
    Join Date
    Aug 2008
    Location
    Paris, France
    Posts
    46

    Smile Works fine, thanks again Linksor

    Should be part of the future versions ...

  5. #5
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    342

    Default

    IMHO it is very difficult to create multilingual SEORewrite rule - so you must change it for your own.

Similar Threads

  1. Characters & URL's
    By rookers in forum v5.x
    Replies: 0
    Last Post: 07-24-2007, 07:20 AM
  2. Replies: 2
    Last Post: 04-02-2005, 10:36 PM
  3. Special Characters
    By hobartimus in forum v5.x
    Replies: 9
    Last Post: 02-28-2005, 02:41 AM
  4. at least 3 characters?
    By binto in forum v5.x
    Replies: 1
    Last Post: 12-11-2001, 05:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •