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
This commit is contained in:
Gary Pendergast 2015-03-30 03:26:44 +00:00
parent 9369d03bc5
commit 3945ee3f86
1 changed files with 1 additions and 1 deletions

View File

@ -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 );
}
}