﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
12251,mb_substr() works strangely in some environment.,Cyrus H.,hakre,"http://wordpress.org/support/topic/357562

First of all, this is not a P2 theme bug; this is WP core bug.
I use English WordPress, but I post a post in Korean.

Summarizing above link: mb_substr() and mb_strlen() shows malfunction when dealing with non-English characters, because '''encoding parameter is not specified'''. This happens when PHP MB extension is enabled, because backward-compatibility function _mb_substr() automatically assumes the encoding as UTF-8 but the extension does not.

Following '''should be''' adopted to 2.9.3:


FILE: /wp-admin/includes/plugin-install.php, line 332[[BR]]
FROM:[[BR]]
$description = mb_substr($description, 0, 400) . '&#8230;';[[BR]]
TO:[[BR]]
$description = mb_substr($description, 0, 400, 'UTF-8') . '&#8230;';[[BR]]


FILE: /wp-admin/includes/post.php, line 1037[[BR]]
FROM:[[BR]]
if ( mb_strlen($post_name) > 30 ) {[[BR]]
TO:[[BR]]
if ( mb_strlen($post_name, 'UTF-8') > 30 ) {[[BR]]


FILE: /wp-admin/includes/post.php, line 1038[[BR]]
FROM:[[BR]]
$post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);[[BR]]
TO:[[BR]]
$post_name_abridged = mb_substr($post_name, 0, 14, 'UTF-8'). '&hellip;' . mb_substr($post_name, -14, 14, 'UTF-8');[[BR]]


FILE: /wp-includes/formatting.php, line 2708[[BR]]
FROM:[[BR]]
$str = mb_substr( $str, 0, $count );[[BR]]
TO:[[BR]]
$str = mb_substr( $str, 0, $count, 'UTF-8' );[[BR]]


Personally, this is very inconvenient: it gives me stress of seeing Unicode Replacement Character.",defect (bug),closed,high,,Charset,2.9.2,normal,worksforme,,toscho sergeybiryukov.ru@…
