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.

Built from https://develop.svn.wordpress.org/trunk@31926


git-svn-id: http://core.svn.wordpress.org/trunk@31905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2015-03-30 03:27:31 +00:00
parent 6cd9c9645e
commit 3ddbef69e3
2 changed files with 2 additions and 2 deletions

View File

@ -4212,7 +4212,7 @@ function wp_encode_emoji( $content ) {
*/ */
$unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) ); $unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
if ( isset( $unpacked[1] ) ) { if ( isset( $unpacked[1] ) ) {
$entity = '&#x' . trim( $unpacked[1], '0' ) . ';'; $entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
$content = str_replace( $emoji, $entity, $content ); $content = str_replace( $emoji, $entity, $content );
} }
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-beta3-31925'; $wp_version = '4.2-beta3-31926';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.