Make WordPress Core

Changeset 31926


Ignore:
Timestamp:
03/30/2015 03:26:44 AM (9 years ago)
Author:
pento
Message:

Emoji: When encoding emoji into HTML entities, 0 was being incorrectly trimmed from the right side of the hex string, causing some characters to be encoded incorrectly.

File:
1 edited

Legend:

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

    r31924 r31926  
    42134213                    $unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
    42144214                    if ( isset( $unpacked[1] ) ) {
    4215                         $entity = '&#x' . trim( $unpacked[1], '0' ) . ';';
     4215                        $entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
    42164216                        $content = str_replace( $emoji, $entity, $content );
    42174217                    }
Note: See TracChangeset for help on using the changeset viewer.