Subject: substr

Posted on: 19/11/05 11:33am
By: berber


I tried to fill in a bug report but got an 404 not found page from your main page on the left.

I wanted to update you that I'm using Geeklog in Hebrew (UTF and I had a problem with the latest comments in the last 48 hours. I tracked the problem down to PHPs substr not supporting UTF8.

I changed in lib-common the substr in COM_whatsNewBlock to

function utf8_substr($str,$from,$len){
	return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'. '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s','$1',$str);

and it works well now.

Please advise.

Geeklog - Forum