Topic: Extern.php encoding problem with function substr


I got an encoding problem with the extern.php script : if there were a special character like é è à ... in the post title exactly at the place where the extern.php?action=new would cut the string, it produces a ? , but there were no problem with those characters at other place in the string.

After some tests I found that was because of the php function substr(), I replaced it by mb_strcut() which could handle multi-bytes characters encoding.

$subject_truncated = pun_htmlspecialchars(trim(mb_strcut( $cur_topic['subject'], 0 , ($max_subject_length-5), "UTF-8" ))).'…';
// old version
//$subject_truncated = pun_htmlspecialchars(trim(substr($cur_topic['subject'], 0, ($max_subject_length-5)))).' …';

perhaps could you use this correction with the option

'lang_encoding'                 =>      'utf8',

Bye, and thanks a lot for your forum !!

This code was modified for the page :

If you are interested we have done some other modifications of punbb :

Re: Extern.php encoding problem with function substr

Moved to Troubleshooting, UTF-8 will be supported in 1.3