Instead of substr
use the mbstring
functions:
echo anchor( 'projects/' . $rs->url_project_title . '/' . $rs->project_id, mb_substr(ucfirst($rs->project_title), 0, 26), 'style="text-decoration:none;"' );
If you do not succeed, it is possible that PHP did not detect the string encoding, and therefore provide the correct encoding mb_substr()
:
// PHP uses internal encoding mb_internal_encoding() echo mb_substr($string, 0, 26); // you specify the encoding - in the case you know in which encoding the input comes echo mb_substr($string, 0, 26, 'UTF-8'); // PHP tries to detect the encoding echo mb_substr($string, 0, 26, mb_detect_encoding($string));
See mb_detect_encoding()
more details.
Hope this helps.
source share