mb_strcut in wp_html_excerpt seems to count bytes (not characters). Use mb_substr instead?
|Reported by:||demetris||Owned by:||nbachiyski|
|Severity:||normal||Keywords:||has-patch tested needs-testing|
The result is that strings with multibyte characters are cut too short.
An instance of this can be seen on edit-comments.php. I have a post with this title:
Î±Î²Î³Î´ÎµÎ¶Î·Î¸Î¹ÎºÎ»Î¼Î½Î¾Î¿Ï€ÏÏƒÏ„Ï…Ï†Ï‡ÏˆÏ‰ Î‘Î’Î“Î”Î•Î–Î—Î˜Î™ÎšÎ›ÎœÎÎžÎŸÎ Î¡Î£Î¤Î¥Î¦Î§Î¨Î©
... which is 49 characters long (the 24 letters of the Greek alphabet + 1 space + the 24 letters in capital form), that is, just below the cut-off limit (50). But WP cuts the string after the 25th character, displaying:
Edit Comments on â€œÎ±Î²Î³Î´ÎµÎ¶Î·Î¸Î¹ÎºÎ»Î¼Î½Î¾Î¿Ï€ÏÏƒÏ„Ï…Ï†Ï‡ÏˆÏ‰ â€
Replacing mb_strcut with mb_substr in wp_html_excerpt seems to fix this. I tried with Japanese and with Greek on WP 2.7 branch and on WP trunk and everything SEEMS to be OK.
Is there a reason mb_substr was not used there? Maybe some issue that has been resolved in the meantime?
Please note that Iâ€™m not a coder and that much of this stuff goes over my head. :-)