Results 1 to 14 of 14

Thread: Special letter problem in other languages

  1. #1
    Frank71 is offline Active Member
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    1,180

    Exclamation Special letter problem in other languages

    Hello,

    Two big problems:

    I show the last anf often searched keywords of the admin menu in a seperatly index out of indexu (because I don't like the indexu index and I have more possibilities outsite ).

    I use the keywordstring to link directly to the search results which I have rewritten with mod_rewrite:

    search-miss%20sixty.html (%20 is what the browser adds for a blank in the url).

    All is working fine, but the problem are german and other special letters like äöüß or for spain ñ and all words with accents and so on.

    For german letters like äöüß indexu only searchs in the database and so it will only find the exact spelling and not transformed spelling like ae oe ue or ss - bad

    Also the keyword will be stored as it is like "möbel" and so I link in last search to search-möbel.html and thats the first really big problem:
    Indexu can't transform that back out of the url and will search for "möbel" without results.

    If I change it by hand to search-m%F6bel.html it is working fine again will find all links with "möbel" in it, but it wiill save the word again as "möbel" and the problems starts new.

    Any ideas for that - for me (and every one who need self optimizing sites) it is very important ?!


    Second problem:
    In my search results I want to include the search results of other scripts for the same keyword:

    include ("domain.com/search.php?KEYWORD

    With special letters here I have the same problem but a little bit bigger is the cased if a user searched for two or more keywords like:

    include ("domain.com/search.php?KEYWORD KEYWORD

    Here I got a blank between the keywords in my include and that can't work.
    So I need a second variable only for the template include with something between the keywords like a "+" or "%20".
    In best case also with rewritten keywords so I have less work with my other script (I want to include the results of 3 other scripts.

    Any ideas ?

    If you can help I can also give some dollars for that

    Regards
    Frank

  2. #2
    Trixicom is offline Registered User
    Join Date
    Jul 2006
    Posts
    9

    Default Same problem: Spanish letters

    I have the same problem...some special letters in Spanish like ó, é, ñ etc. doesn't come out on the right way...How to fix it?

  3. #3
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    So, I'll have the same problem with accents in French when I'll try to display the last searched keywords

    é, è, *, ù, ü, ê, î, û, ô...

    and ç

  4. #4
    enrico is offline Registered User
    Join Date
    Aug 2006
    Posts
    19

    Default

    Any Ideas?

  5. #5
    gtithesexy is offline Registered User
    Join Date
    Jan 2005
    Posts
    10

    Default

    me too

  6. #6
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    Hello...

    I found the solution to the letters with accents in the URL rewriting.

    It's that :
    PHP Code:
    $result=strtr($chaine,"ÀÁÂÃÄÅ*áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏì*îïÙÚÛÜùúûüÿÑñ","AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"); 
    But I'm not a developer and I hate the code

    So, I suppose the code must be placed into the lib/mod-rewrite.lib.php file, but don't like to study all the complicated "salamaleks" necessary to insert correctly this line inside the other lines.

    Can anybody do that elegantly ?

    Thanks a lot

    Mickey

  7. #7
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    Another step :

    PHP Code:
    function accent($accents){
      
    $accents strtr($accents,  "ÀÁÂÃÄÅ*áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏì*îïÙÚÛÜùúûüÿÑñ",  "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");
      return 
    $accents;
      } 

  8. #8
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    Another different piece of code to include somewhere in a file... But where ?

    PHP Code:
    function make_url_friendly($url)
    {

       
    $url trim($url);

       
    $url strtolower($url);

       
    // Fix for most recent topics block
       // or else a b is shown in every url
       
    $find = array('<b>',
          
    '</b>');
       
    $url str_replace ($find''$url);

       
    $url preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/''image'$url);

       
    $find = array(' ',
          
    '&quot;',
          
    '&',
          
    '\r\n',
          
    '\n',
          
    '/',
          
    '\\',
          
    '+',
          
    '<',
          
    '>');
       
    $url str_replace ($find'-'$url);

       
    $find = array('é',
          
    'è',
          
    'ë',
          
    'ê',
          
    'É',
          
    'È',
          
    'Ë',
          
    'Ê');
       
    $url str_replace ($find'e'$url);

       
    $find = array('*',
          
    'ì',
          
    'î',
          
    'ï',
          
    'Í',
          
    'Ì',
          
    'Î',
          
    'Ï');
       
    $url str_replace ($find'i'$url);

       
    $find = array('ó',
          
    'ò',
          
    'ô',
          
    'Ó',
          
    'Ò',
          
    'Ô');
       
    $url str_replace ($find'o'$url);

       
    $find = array('ö',
           
    'Ö');
       
    $url str_replace ($find'oe'$url);

       
    $find = array('á',
          
    '*',
          
    'â',
          
    'Á',
          
    'À',
          
    'Â');
       
    $url str_replace ($find'a'$url);

       
    $find = array('ä',
           
    'Ä');
       
    $url str_replace ($find'ae'$url);

       
    $find = array('ú',
          
    'ù',
          
    'û',
          
    'Ú',
          
    'Ù',
          
    'Û');
       
    $url str_replace ($find'u'$url);

       
    $find = array('ü',
           
    'Ü');
       
    $url str_replace ($find'ue'$url);

       
    $find = array('ß');
       
    $url str_replace ($find'ss'$url);

       
    $find = array('ç');
       
    $url str_replace ($find'c'$url);

       
    $find = array('/[^a-z0-9\-<>]/',
          
    '/[\-]+/',
          
    '/<[^>]*>/');

       
    $repl = array('',
          
    '-',
          
    '');

       
    $url =  preg_replace ($find$repl$url);

       
    $url str_replace ('--''-'$url);

       return 
    $url;



  9. #9
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    Finally, the solution is to insert a new function inside the one we find on line 340 of the file lib/misc.lib.php
    :

    PHP Code:
      // ----- SEOReplace -----



      
    function SEOReplace($string) {

        
    $seo_replacement_str_arr = array (

          
    ' ',

          
    '-',

          
    '/',

          
    '\\',

          
    ',',

          
    '#',

          
    ':',

          
    ';',

          
    '\'',

          
    '"',

          
    '[',

          
    ']',

          
    '{',

          
    '}',

          
    '|',

          
    '`',

          
    '~',

          
    '!',

          
    '@',

          
    '%',

          
    '$',

          
    '^',

          
    '&',

          
    '*',

          
    '=',

          
    '+'

        
    );

        return 
    str_replace($seo_replacement_str_arr'-'$string);

      } 
    But how to insert something like that

    PHP Code:
    function SEOReplacenew($string) { 
      
    $string strtr($string,  "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",  "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");

        return 
    $string;

      } 
    ... inside the existing function ?

    I HATE code and all the complicated things to respect each time you write a simple sign !

    Anyone here to make this mod in a clean way ?

    I suppose there are now just details to adjust, but that everything is correct globally ?

    Thanks a lot !
    Last edited by Mickey; 10-01-2006 at 04:06 AM.

  10. #10
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    Thanks. I didn't test yet, but logically will work
    PHP Code:
    / ----- SEOReplace -----



      function 
    SEOReplace($string) {

        
    $string strtr($string,  
                        
    "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
                          
    "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");

        
    $seo_replacement_str_arr = array (

          
    ' ',

          
    '-',

          
    '/',

          
    '\\',

          
    ',',

          
    '#',

          
    ':',

          
    ';',

          
    '\'',

          
    '"',

          
    '[',

          
    ']',

          
    '{',

          
    '}',

          
    '|',

          
    '`',

          
    '~',

          
    '!',

          
    '@',

          
    '%',

          
    '$',

          
    '^',

          
    '&',

          
    '*',

          
    '=',

          
    '+'

        
    );

        return 
    str_replace($seo_replacement_str_arr'-'$string);

      } 
    www.nicecoder.com
    www.dodyrw.com

  11. #11
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    Hello, Dody...

    Thanks a lot for your intervention.

    It works, but not perfectly.

    I obtain now : /informatique--internet--telephonie/ (for the category Informatique, internet, t&#233;l&#233;phonie)
    or
    sante--beaute/ (for the category Sant&#233;, beaut&#233

    The "&#233;" are replaced by an "e", but now there are two "--", and when we click on the link, we get a 404 error page.

    The double "--" doesn't appear when the name of the category has no accent, and everything works like before in this case.

    So, the error comes surely from a "double treatment" of the titles with accents, and of a single treatment of the "normal titles" (without accents).

    When the title of the category (or the subcategory) is just one word with an accent, the URL looks correct (example : societe/ or /arts/musees/ , the &#233; with accent of soci&#233;t&#233; or mus&#233;es is replaced by an e), but the links gives a 404 error page.
    Last edited by Mickey; 10-02-2006 at 08:14 AM.

  12. #12
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    It's incredible ! It works now !

    I surely forgot to "Update Category Path" after I installed the new file.

    The only remaining problem has nothing to see with the accents. It's the double "--".
    I tested it, and I have seen that it's only due to commas.

    When there is a "comma + space" in the name of a category, it's replaced by a double "--". I think it's normal.

    So, we can consider that there is not problem with the accents now.

    Thanks a lot, Dody !
    Last edited by Mickey; 10-02-2006 at 11:50 AM.

  13. #13
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    I surprise that the double - is occur there. It should be elimitated since 5.3.0

    The following red code will eliminate double -

    Code:
        $string = str_replace($seo_replacement_str_arr, '-', $string);
        $string = preg_replace(array('/-+/', '/-$/', '/-indexuslash/'), 
                               array('-', '', 'indexuslash') , $string);
        $string = urlencode(strtolower($string));
        return $string;
      }
    www.nicecoder.com
    www.dodyrw.com

  14. #14
    Mickey is offline Registered User
    Join Date
    Jul 2006
    Location
    Paris, France
    Posts
    108

    Default

    Thanks a lot, it works better now
    All the letters with accents are replaced by "standard" letters, and the double "--" have disappeared.

    I started with 5.1 version, and I added just a part of the files with 5.2, and when the 5.3 arrived, I used a bad method to modify my files...

    I was frightened to loose all my custom mods, and I looked at the list you gave in the install.txt, but the list of "files to delete", "modified files" and "new files" was not exhaustive..

    So, I forgot the filters folder, I was obliged to modify all the templates of my blocks, add manually many fields in the database, etc.

    I think the best method is to replace ALL the files, and to add one by one all the custom mods to the new files.

    But to do that, the webmaster must note on a small book all the custom mods.

    Thanks for you excellent script

Similar Threads

  1. New MOD - List Sites by the first letter of the Title
    By esm in forum Blocks and Modification
    Replies: 7
    Last Post: 01-30-2007, 02:03 PM
  2. one indexu site for 2 languages ?!
    By Frank71 in forum v5.x
    Replies: 5
    Last Post: 02-21-2005, 09:20 PM
  3. Problem with bold_format
    By fredparis in forum v5.x
    Replies: 3
    Last Post: 11-18-2003, 07:44 PM
  4. User login problem
    By webmasterjr in forum v5.x
    Replies: 3
    Last Post: 12-16-2002, 07:03 AM

Posting Permissions

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