soaivu / clipbucket

Automatically exported from code.google.com/p/clipbucket
0 stars 0 forks source link

Error while using French Chars in URL (special char in video title) #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
By default, when a video title contains special french chars (à,é,è,ç,...), 
there's a problem with browser "The page isn't redirecting properly".

To correct this problem, you just have to modify the file 
"includes/define_php_links.php" :

<code>
$seo_urls = @SEO;           //  yes/no
 /*function SEO( $text, $slash=false ) {

    $text = preg_replace('/ \&\#?[(0-9a-zA-Z){4}]+\;/','',$text);
    $entities_match     = array('&quot;','!','@','#','%','^','&','*','_','(',')','+','{','}','|',':','"','<','>','?','[',']','\\',';','"',',','.','/','*','+','~','`','=',"'");
    $entities_replace   = array('','','','','','','','','','','','','','','','','','','','','','','','');
    $clean_text         = str_replace($entities_match, $entities_replace, $text);
    $clean_text = trim($clean_text);
    $clean_text = preg_replace('/ /','-',$clean_text);
    if ( $clean_text != '' )
        $slash              = ( $slash ) ? '/' : NULL;

    $clean_text = preg_replace('/\-{2,10}/','-',$clean_text);

    return $slash . $clean_text;
}   */

//HACK : http://cubiq.org/the-perfect-php-clean-url-generator 
setlocale(LC_ALL, 'fr_FR.UTF8');
function SEO( $text, $slash=false ) {
    $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $text);
    $clean = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $clean);
    $clean = preg_replace("/8217/", '-', $clean); //remove "apostrophe"
    $clean = strtolower(trim($clean, '-'));
    $clean = preg_replace("/[\/_| -]+/", '-', $clean);
    if ( $clean != '' )
        $slash = ( $slash ) ? '/' : NULL;

    return $slash . $clean;
}
</code>

Original issue reported on code.google.com by didier.s...@gmail.com on 1 May 2012 at 5:04

GoogleCodeExporter commented 9 years ago
I worked perfectly thanks
you can see the page http://www.youmexvideo.com/

Original comment by youmexvi...@gmail.com on 21 Oct 2012 at 2:29

GoogleCodeExporter commented 9 years ago

Original comment by zomail...@gmail.com on 6 May 2013 at 11:48

GoogleCodeExporter commented 9 years ago

Original comment by fawaz...@gmail.com on 20 Aug 2013 at 7:02