php-mbstring

Discussion in 'PHP' started by #Wolf#, 21 Nov 2009.

  1. #Wolf#

    #Wolf# Elder - Старейшина

    Joined:
    26 Mar 2008
    Messages:
    375
    Likes Received:
    166
    Reputations:
    16
    ставлю на CentOS 5 модуль php-mbstring
    и слетают русскоязычные урл(site.com/linux/ubuntu/вышла-ubuntu-9-10) в вордпрессе.
    Будут ли какие-нибудь идеи у вас?
     
  2. nerezus

    nerezus Banned

    Joined:
    12 Aug 2004
    Messages:
    3,191
    Likes Received:
    727
    Reputations:
    266
    идея в том, что mbstring могла быть юзаема в вордпрессе при ее наличии, а из-за косяков в базе(неверные кодировки) она стала неверно работать.
     
  3. #Wolf#

    #Wolf# Elder - Старейшина

    Joined:
    26 Mar 2008
    Messages:
    375
    Likes Received:
    166
    Reputations:
    16
    нашел эту строку, портящую всю жизнь)
    PHP:
    function sanitize_title_with_dashes($title) {
        
    $title = strip_tags($title);
        
    $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
        
    $title = str_replace('%', '', $title);
    $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);

        
    $title = remove_accents($title);
        if (
    seems_utf8($title)) {
            
    /*if (function_exists('mb_strtolower')) {
                $title = mb_strtolower($title,'UTF-8');  <------------------
            }*/
            
    $title = utf8_uri_encode($title, 200);
        }

        
    $title = strtolower($title);
        
    $title = preg_replace('/&.+?;/', '', $title); 
        
    $title = str_replace('.', '-', $title);
        
    $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
        
    $title = preg_replace('/\s+/', '-', $title);
        
    $title = preg_replace('|-+|', '-', $title);
        
    $title = trim($title, '-');

        return 
    $title;
    }