Ticket #3843: formatting-7-2-4am.diff

File formatting-7-2-4am.diff, 1.0 kB (added by noel, 4 months ago)

Unicode fixes that do not produce a 404.

  • wp-includes/formatting.php

    old new  
    348348        $title = str_replace('%', '', $title); 
    349349        // Restore octets. 
    350350        $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); 
    351  
     351         
     352        // Preserve escaped octets. 
     353        $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); 
     354        // Fix unicode characters in the wrong category 
     355        $title = preg_replace( '/[\p{P}\p{So}\p{M}\p{No}\p{Nl}]/u', '-', $title); 
     356        // Restore octets. 
     357        $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); 
     358         
    352359        $title = remove_accents($title); 
    353360        if (seems_utf8($title)) { 
    354361                if (function_exists('mb_strtolower')) { 
     
    356363                } 
    357364                $title = utf8_uri_encode($title, 200); 
    358365        } 
    359  
     366         
    360367        $title = strtolower($title); 
    361368        $title = preg_replace('/&.+?;/', '', $title); // kill entities 
    362369        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);