Index: src/wp-admin/includes/post.php
===================================================================
--- src/wp-admin/includes/post.php	(revision 29719)
+++ src/wp-admin/includes/post.php	(working copy)
@@ -1205,10 +1205,8 @@
 			$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
 		}
 	} else {
-		if ( function_exists( 'mb_strlen' ) && mb_strlen( $post_name ) > 30 ) {
+		if ( mb_strlen( $post_name ) > 30 ) {
 			$post_name_abridged = mb_substr( $post_name, 0, 14 ) . '&hellip;' . mb_substr( $post_name, -14 );
-		} elseif ( strlen( $post_name ) > 30 ) {
-			$post_name_abridged = substr( $post_name, 0, 14 ) . '&hellip;' . substr( $post_name, -14 );
 		} else {
 			$post_name_abridged = $post_name;
 		}
Index: src/wp-includes/compat.php
===================================================================
--- src/wp-includes/compat.php	(revision 29719)
+++ src/wp-includes/compat.php	(working copy)
@@ -13,25 +13,43 @@
 	}
 }
 
-if ( !function_exists('mb_substr') ):
-	function mb_substr( $str, $start, $length=null, $encoding=null ) {
-		return _mb_substr($str, $start, $length, $encoding);
+if ( ! function_exists( 'mb_substr' ) ) :
+	function mb_substr( $str, $start, $length = null, $encoding = null ) {
+		return _mb_substr( $str, $start, $length, $encoding );
 	}
 endif;
 
-function _mb_substr( $str, $start, $length=null, $encoding=null ) {
-	// the solution below, works only for utf-8, so in case of a different
-	// charset, just use built-in substr
+function _mb_substr( $str, $start, $length = null, $encoding = null ) {
+	// The solution below works only for UTF-8,
+	// so in case of a different charset just use built-in substr()
 	$charset = get_option( 'blog_charset' );
-	if ( !in_array( $charset, array('utf8', 'utf-8', 'UTF8', 'UTF-8') ) ) {
-		return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length);
+	if ( ! in_array( $charset, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
+		return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length );
 	}
-	// use the regex unicode support to separate the UTF-8 characters into an array
+	// Use the regex unicode support to separate the UTF-8 characters into an array
 	preg_match_all( '/./us', $str, $match );
-	$chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
+	$chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
 	return implode( '', $chars );
 }
 
+if ( ! function_exists( 'mb_strlen' ) ) :
+	function mb_strlen( $str, $encoding = null ) {
+		return _mb_strlen( $str, $encoding );
+	}
+endif;
+
+function _mb_strlen( $str, $encoding = null ) {
+	// The solution below works only for UTF-8,
+	// so in case of a different charset just use built-in substr()
+	$charset = get_option( 'blog_charset' );
+	if ( ! in_array( $charset, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
+		return strlen( $str );
+	}
+	// Use the regex unicode support to separate the UTF-8 characters into an array
+	preg_match_all( '/./us', $str, $match );
+	return count( $match[0] );
+}
+
 if ( !function_exists('hash_hmac') ):
 function hash_hmac($algo, $data, $key, $raw_output = false) {
 	return _hash_hmac($algo, $data, $key, $raw_output);
Index: tests/phpunit/tests/post.php
===================================================================
--- tests/phpunit/tests/post.php	(revision 29719)
+++ tests/phpunit/tests/post.php	(working copy)
@@ -499,6 +499,45 @@
 	}
 
 	/**
+	 * @ticket 29573
+	 */
+	function test_get_sample_permalink_html_with_non_latin_slugs() {
+		$inputs = array(
+			'Αρνάκι άσπρο και παχύ της μάνας του καμάρι, και άλλα τραγούδια',
+			'Предлагаем супер металлообрабатывающее оборудование',
+			'בניית אתרי וורדפרס',
+			'This is a very long post name that is both UTF-8 and > 30 chars.',
+		);
+
+		$outputs = array(
+			'αρνάκι-άσπρο-κ&hellip;-μάνας-του-καμ',
+			'предлагаем-суп&hellip;ллообрабатываю',
+			'בניית-אתרי-וורדפרס',
+			'this-is-a-very&hellip;8-and-30-chars',
+		);
+
+		$old_permastruct = get_option( 'permalink_structure' );
+		update_option( 'permalink_structure', '/%postname%/' );
+
+		foreach ( $inputs as $k => $post_title ) {
+			$post = array(
+				'post_author' => $this->author_id,
+				'post_status' => 'publish',
+				'post_content' => rand_str(),
+				'post_title' => $post_title,
+			);
+
+			$id = $this->post_ids[] = wp_insert_post( $post );
+			$sample_permalink_html = get_sample_permalink_html( $id );
+			preg_match( '#<span id="editable-post-name".*?>(.+?)</span>#', $sample_permalink_html, $matches );
+
+			$this->assertEquals( $outputs[ $k ], $matches[1] );
+		}
+
+		update_option( 'permalink_structure', $old_permastruct );
+	}
+
+	/**
 	 * @ticket 15665
 	 */
 	function test_get_page_by_path_priority() {
