Invalid UTF-8 excerpt was sent in trackback

Found a bug? Tell us!!
Post Reply
Hideki ONO
Posts: 1
Joined: Fri May 26, 2006 1:54 am

Invalid UTF-8 excerpt was sent in trackback

Post 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);
 }

 /**
Hideki ONO
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Invalid UTF-8 excerpt was sent in trackback

Post by garvinhicking »

Hi!

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply