From 3945ee3f86a0d4b31e22e00606e8b0999d1e0161 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 30 Mar 2015 03:26:44 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@31926 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 579d6b853b..6b4e9112e0 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -4212,7 +4212,7 @@ function wp_encode_emoji( $content ) { */ $unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) ); if ( isset( $unpacked[1] ) ) { - $entity = '&#x' . trim( $unpacked[1], '0' ) . ';'; + $entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';'; $content = str_replace( $emoji, $entity, $content ); } }