Our website is in Chinese and a part of the main page shows a list of other page titles at a maximum length of what works out as being called '26' (I assume this is using the English character count if the Chinese characters were written using English?). The line we use for this is:
<?php echo anchor('projects/'.$rs->url_project_title.'/'.$rs->project_id,substr(ucfirst($rs->project_title),0,26),'style="text-decoration:none;"'); ?>
However, if the title is indeed to long the code truncates it as it should but the final two Chinese characters are always shown as �� as I'm guessing it's using the English version of the words and splitting a Chinese character (somehow). Maybe I'm over thinking this!?
For example....
Original:
在国内做一个尊重艺术,能够为青年导演提供平
Truncated version:
在国内做一个尊重��
Can you perhaps suggest a modification to enable the desired number of characters show without resulting in the ��'s?
echo anchor( 'projects/' . $rs->url_project_title . '/' . $rs->project_id, mb_substr(ucfirst($rs->project_title), 0, 26,'UTF-8'), 'style="text-decoration:none;"' );
– Corpuscle