WordPress.org

Make WordPress Core

Changeset 38809


Ignore:
Timestamp:
10/17/2016 11:53:20 PM (21 months ago)
Author:
pento
Message:

Charset: Allow _canonical_charset() to handle mixed-case strings.

Add improved unit tests, and collect existing unit tests together.

Props pbearne.
Fixes #38337.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r38804 r38809  
    556556
    557557    //TODO: Tidy this ghetto code up and make the debug code optional
    558     include_once( ABSPATH . WPINC . '/class-IXR.php' ); 
     558    include_once( ABSPATH . WPINC . '/class-IXR.php' );
    559559
    560560    $post_links = array();
     
    52515251 */
    52525252function _canonical_charset( $charset ) {
    5253     if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
    5254         'UTF8' === $charset )
     5253    if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset) ) {
     5254
    52555255        return 'UTF-8';
    5256 
    5257     if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
    5258         'iso8859-1' === $charset || 'ISO8859-1' === $charset )
     5256    }
     5257
     5258    if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) {
     5259
    52595260        return 'ISO-8859-1';
     5261    }
    52605262
    52615263    return $charset;
Note: See TracChangeset for help on using the changeset viewer.