Page 1 of 1

Invalid UTF-8 excerpt was sent in trackback

Posted: Fri May 26, 2006 3:29 am
by Hideki ONO
Version: serendipity-1.1alpha5(s9y_200605241538.tar.gz)

Invalid UTF-8 excerpt can be sent in trackback because UTF-8 encoded excerpt string is cut with bad boudary in multibyte characters.
Attached patch uses serendipity_mb('substr') instead of substr().

Code: Select all

--- include/functions_trackbacks.inc.php.orig     2006-04-21 21:44:55.000000000 +0900
+++ include/functions_trackbacks.inc.php        2006-05-26 02:51:20.000000000 +0900
@@ -334,7 +334,7 @@
  * @return  string  Output text
  */
 function serendipity_trackback_excerpt($text) {
-    return substr(strip_tags($text), 0, 255);
+    return serendipity_mb('substr', strip_tags($text), 0, 255);
 }

 /**

Re: Invalid UTF-8 excerpt was sent in trackback

Posted: Fri May 26, 2006 2:34 pm
by garvinhicking
Hi!

Thanks a lot for that, of course you're right! I just committed this to SVN!

Regards,
Garvin