Index: tests/phpunit/tests/term/query.php
===================================================================
--- tests/phpunit/tests/term/query.php	(revision 41813)
+++ tests/phpunit/tests/term/query.php	(working copy)
@@ -528,4 +528,37 @@
 
 		$this->assertEqualSets( array( $term_1, $term_1 ), wp_list_pluck( $q->terms, 'term_id' ) );
 	}
+
+	/**
+	 * @ticket 42096
+	 */
+	public function test_term_query_by_slug_should_support_slugs_created_pre_3_3() {
+		global $wpdb;
+
+		// pre-3.3 supported slug
+		$slug = 'foo-%c3%a5-bar-%e2%80%9cquoted-text%e2%80%9d';
+
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		// Manually add term with example name and slug with pre-3.3 supported values
+		$wpdb->insert( $wpdb->terms, array(
+			'term_id' => 42096,
+			'name' => 'foo--bar-quoted-text',
+			'slug' => $slug,
+			) );
+
+		$wpdb->insert( $wpdb->term_taxonomy, array(
+			'term_id' => 42096,
+			'taxonomy' => 'wptests_tax',
+			) );
+
+		$q = new WP_Term_Query( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => $slug,
+			'hide_empty' => false,
+			'fields' => 'ids',
+			) );
+
+		$this->assertEquals( array( 42096 ), $q->terms );
+	}
 }
Index: tests/phpunit/tests/query/taxQuery.php
===================================================================
--- tests/phpunit/tests/query/taxQuery.php	(revision 41813)
+++ tests/phpunit/tests/query/taxQuery.php	(working copy)
@@ -1409,4 +1409,35 @@
 
 		$this->assertEqualSets( array( $p ), $q->posts );
 	}
+
+	/**
+	 * @ticket 42096
+	 */
+	public function test_query_by_tag_slug_should_support_slugs_created_pre_3_3() {
+		global $wpdb;
+
+		// pre-3.3 supported slug
+		$slug = 'foo-%c3%a5-bar-%e2%80%9cquoted-text%e2%80%9d';
+
+		$wpdb->insert( $wpdb->terms, array(
+			'term_id' => 42096,
+			'name' => 'foo--bar-quoted-text',
+			'slug' => $slug,
+		) );
+
+		$wpdb->insert( $wpdb->term_taxonomy, array(
+			'term_id' => 42096,
+			'taxonomy' => 'post_tag',
+		) );
+
+		$p = self::factory()->post->create();
+		wp_set_object_terms( $p, array( 42096 ), 'post_tag' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'tag' => $slug,
+		) );
+
+		$this->assertEquals( array( $p ), $q->posts );
+	}
 }
