diff --git a/src/wp-admin/js/inline-edit-post.js b/src/wp-admin/js/inline-edit-post.js
index 9f1b13b..8683505 100644
--- a/src/wp-admin/js/inline-edit-post.js
+++ b/src/wp-admin/js/inline-edit-post.js
@@ -117,7 +117,7 @@ inlineEditPost = {
 	},
 
 	edit : function(id) {
-		var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f;
+		var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f, val;
 		t.revert();
 
 		if ( typeof(id) === 'object' ) {
@@ -155,7 +155,11 @@ inlineEditPost = {
 		});
 
 		for ( f = 0; f < fields.length; f++ ) {
-			$(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() );
+			val = $('.'+fields[f], rowData);
+			// Deal with Twemoji
+			val.find( 'img' ).replaceWith( function() { return this.alt; } );
+			val = val.text();
+			$(':input[name="' + fields[f] + '"]', editRow).val( val );
 		}
 
 		if ( $( '.comment_status', rowData ).text() === 'open' ) {
@@ -181,11 +185,14 @@ inlineEditPost = {
 
 		//flat taxonomies
 		$('.tags_input', rowData).each(function(){
-			var terms = $(this).text(),
+			var terms = $(this),
 				taxname = $(this).attr('id').replace('_' + id, ''),
 				textarea = $('textarea.tax_input_' + taxname, editRow),
 				comma = inlineEditL10n.comma;
 
+			terms.find( 'img' ).replaceWith( function() { return this.alt; } );
+			terms = terms.text();
+
 			if ( terms ) {
 				if ( ',' !== comma ) {
 					terms = terms.replace(/,/g, comma);
@@ -265,6 +272,9 @@ inlineEditPost = {
 					if ( -1 !== r.indexOf( '<tr' ) ) {
 						$(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove();
 						$('#edit-'+id).before(r).remove();
+						if ( WPEmoji ) {
+							WPEmoji.parse( $( inlineEditPost.what + id ).get( 0 ) );
+						}
 						$(inlineEditPost.what+id).hide().fadeIn();
 					} else {
 						r = r.replace( /<.[^<>]*?>/g, '' );
diff --git a/src/wp-admin/js/inline-edit-tax.js b/src/wp-admin/js/inline-edit-tax.js
index 7f3a5b3..dde6082 100644
--- a/src/wp-admin/js/inline-edit-tax.js
+++ b/src/wp-admin/js/inline-edit-tax.js
@@ -45,7 +45,7 @@ inlineEditTax = {
 	},
 
 	edit : function(id) {
-		var editRow, rowData,
+		var editRow, rowData, val,
 			t = this;
 		t.revert();
 
@@ -58,8 +58,15 @@ inlineEditTax = {
 
 		$(t.what+id).hide().before(editRow).before('<tr class="hidden"></tr>');
 
-		$(':input[name="name"]', editRow).val( $('.name', rowData).text() );
-		$(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );
+		val = $('.name', rowData);
+		val.find( 'img' ).replaceWith( function() { return this.alt; } );
+		val = val.text();
+		$(':input[name="name"]', editRow).val( val );
+
+		val = $('.slug', rowData);
+		val.find( 'img' ).replaceWith( function() { return this.alt; } );
+		val = val.text();
+		$(':input[name="slug"]', editRow).val( val );
 
 		$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
 		$('.ptitle', editRow).eq(0).focus();
@@ -110,6 +117,10 @@ inlineEditTax = {
 						// Update the value in the Parent dropdown.
 						$( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() );
 
+						if ( WPEmoji ) {
+							WPEmoji.parse( row.get( 0 ) );
+						}
+
 						row.hide().fadeIn();
 					} else {
 						$('#edit-'+id+' .inline-edit-save .error').html(r).show();
diff --git a/src/wp-admin/js/post.js b/src/wp-admin/js/post.js
index 178deb3..7ab9e08 100644
--- a/src/wp-admin/js/post.js
+++ b/src/wp-admin/js/post.js
@@ -712,7 +712,11 @@ jQuery(document).ready( function($) {
 			revert_slug = real_slug.val(),
 			b = $('#edit-slug-buttons'),
 			revert_b = b.html(),
-			full = $('#editable-post-name-full').html();
+			full = $('#editable-post-name-full');
+
+		// Deal with Twemoji in the post-name
+		full.find( 'img' ).replaceWith( function() { return this.alt; } );
+		full = full.html();
 
 		$('#view-post-btn').hide();
 		b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
@@ -736,6 +740,11 @@ jQuery(document).ready( function($) {
 						box.removeClass('hidden');
 					});
 				}
+
+				if ( WPEmoji ) {
+					WPEmoji.parse( box.get( 0 ) );
+				}
+
 				b.html(revert_b);
 				real_slug.val(new_slug);
 				$('#view-post-btn').show();
diff --git a/src/wp-admin/js/tags.js b/src/wp-admin/js/tags.js
index 333a2eb..4ac6f2e 100644
--- a/src/wp-admin/js/tags.js
+++ b/src/wp-admin/js/tags.js
@@ -49,6 +49,10 @@ jQuery(document).ready(function($) {
 			else
 				$( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
 
+			if ( WPEmoji ) {
+				WPEmoji.parse( $( '.tags' ).get( 0 ) );
+			}
+
 			$('.tags .no-items').remove();
 
 			if ( form.find('select#parent') ) {
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index a18f796..ab13e7d 100644
--- a/src/wp-includes/formatting.php
+++ b/src/wp-includes/formatting.php
@@ -785,21 +785,27 @@ function utf8_uri_encode( $utf8_string, $length = 0 ) {
 			$unicode .= chr($value);
 			$unicode_length++;
 		} else {
-			if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
+			if ( count( $values ) == 0 ) {
+				if ( $value < 224 ) {
+					$num_octets = 2;
+				} elseif ( $value < 240 ) {
+					$num_octets = 3;
+				} else {
+					$num_octets = 4;
+				}
+			}
 
 			$values[] = $value;
 
 			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
 				break;
 			if ( count( $values ) == $num_octets ) {
-				if ($num_octets == 3) {
-					$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
-					$unicode_length += 9;
-				} else {
-					$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
-					$unicode_length += 6;
+				for ( $j = 0; $j < $num_octets; $j++ ) {
+					$unicode .= '%' . dechex( $values[ $j ] );
 				}
 
+				$unicode_length += $num_octets * 3;
+
 				$values = array();
 				$num_octets = 1;
 			}
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index f27b7b6..c7a923e 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -2879,13 +2879,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
 
 	$slug_provided = ! empty( $args['slug'] );
 	if ( ! $slug_provided ) {
-		$_name = trim( $name );
-		$existing_term = get_term_by( 'name', $_name, $taxonomy );
-		if ( $existing_term ) {
-			$slug = $existing_term->slug;
-		} else {
-			$slug = sanitize_title( $name );
-		}
+		$slug = sanitize_title( $name );
 	} else {
 		$slug = $args['slug'];
 	}
@@ -2910,20 +2904,14 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
 	}
 
 	// Terms with duplicate names are not allowed at the same level of a taxonomy hierarchy.
-	if ( $exists = term_exists( $slug, $taxonomy ) ) {
-		$existing_term = get_term( $exists['term_id'], $taxonomy );
-
-		if ( $name === $existing_term->name ) {
-
-			if ( is_taxonomy_hierarchical( $taxonomy ) ) {
-				$siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) );
-				if ( in_array( $name, $siblings ) ) {
-					return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists with this parent.' ), $exists['term_id'] );
-				}
-
-			} else {
-				return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists in this taxonomy.' ), $exists['term_id'] );
+	if ( $existing_term = get_term_by( 'name', $name, $taxonomy ) ) {
+		if ( is_taxonomy_hierarchical( $taxonomy ) ) {
+			$siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) );
+			if ( in_array( $name, $siblings ) ) {
+				return new WP_Error( 'term_exists', __( 'A term with the name already exists with this parent.' ), $existing_term->term_id );
 			}
+		} else {
+			return new WP_Error( 'term_exists', __( 'A term with the name already exists in this taxonomy.' ), $existing_term->term_id );
 		}
 	}
 
diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php
index 445713b..712663e 100644
--- a/tests/phpunit/tests/term.php
+++ b/tests/phpunit/tests/term.php
@@ -174,8 +174,9 @@ class Tests_Term extends WP_UnitTestCase {
 
 		// Test existing term name with unique slug
 		$term1 = $this->factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
-		$this->assertFalse( is_wp_error( $term1 ) );
-		$this->assertTrue( empty($term1->errors ) );
+		$this->assertTrue( is_wp_error( $term1 ) );
+		$this->assertSame( 'term_exists', $term1->get_error_code() );
+		$this->assertEquals( $term->term_id, $term1->get_error_data() );
 
 		// Test an existing term name
 		$term2 = $this->factory->tag->create( array( 'name' => 'Bozo' ) );
