Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 38087)
+++ src/wp-includes/formatting.php	(working copy)
@@ -5100,6 +5100,7 @@
 
 		// If it's not a tag and not in ignore block.
 		if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
+			// Flags.
 			$matches = array();
 			if ( preg_match_all( '/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches ) ) {
 				if ( ! empty( $matches[0] ) ) {
@@ -5115,12 +5116,27 @@
 			}
 
 			// Loosely match the Emoji Unicode range.
-			$regex = '/(&#x[2-3][0-9a-f]{3};|&#x1f[1-6][0-9a-f]{2};)/';
+			$unicode_range = '(&#x[2-3][0-9a-f]{3};|&#x1f[1-9][0-9a-f]{2};)';
 
+			// Diversity.
 			$matches = array();
-			if ( preg_match_all( $regex, $content, $matches ) ) {
+			if ( preg_match_all( "/($unicode_range&#x1f3f[b-f];)/", $content, $matches ) ) {
 				if ( ! empty( $matches[1] ) ) {
 					foreach ( $matches[1] as $emoji ) {
+						$chars = str_replace( array( '&#x', ';'), '', $emoji );
+
+						list( $char1, $char2 ) = str_split( $chars, 5 );
+						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char1 . '-' . $char2 . $ext, html_entity_decode( $emoji ) );
+
+						$content = str_replace( $emoji, $entity, $content );
+					}
+				}
+			}
+
+			$matches = array();
+			if ( preg_match_all( "/$unicode_range/", $content, $matches ) ) {
+				if ( ! empty( $matches[1] ) ) {
+					foreach ( $matches[1] as $emoji ) {
 						$char = str_replace( array( '&#x', ';'), '', $emoji );
 						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char . $ext, html_entity_decode( $emoji ) );
 
Index: tests/phpunit/tests/formatting/Emoji.php
===================================================================
--- tests/phpunit/tests/formatting/Emoji.php	(revision 38087)
+++ tests/phpunit/tests/formatting/Emoji.php	(working copy)
@@ -65,4 +65,21 @@
 		remove_filter( 'emoji_url', array( $this, '_filtered_emoji_png_cdn' ) );
 	}
 
+	/**
+	 * @ticket 35293
+	 */
+	public function test_wp_staticize_emoji() {
+		$this->assertContains( 'https://s.w.org/images/core/emoji/2/72x72/1f60e.png', wp_staticize_emoji( '😎' ) ); // Unicode 6: smiling face with sunglasses
+		$this->assertContains( 'https://s.w.org/images/core/emoji/2/72x72/1f44d-1f3fb.png', wp_staticize_emoji( '👍🏻' ) ); // Unicode 8: thumbs up sign
+		$this->assertContains( 'https://s.w.org/images/core/emoji/2/72x72/1f923.png', wp_staticize_emoji( '🤣' ) ); // Unicode 9: rolling on the floor laughing
+	}
+
+	/**
+	 * @ticket 352932
+	 */
+	public function test_wp_encode_emoji() {
+		$this->assertSame( '&#x1f60e;', wp_encode_emoji( '😎' ) ); // Unicode 6: smiling face with sunglasses
+		$this->assertSame( '&#x1f44d;&#x1f3fb;', wp_encode_emoji( '👍🏻' ) ); // Unicode 8: thumbs up sign
+		$this->assertSame( '&#x1f923;', wp_encode_emoji( '🤣' ) ); // Unicode 9: rolling on the floor laughing
+	}
 }
