Substr eating chars
Posted: Tue Dec 22, 2009 3:56 pm
Hi, my substr function is eating 2 byte (i think) chars such as ö,ä,ü,õ which eventually leads to having "?" in the values.
For example:
$roflmao1 = "somerandomtext";
$roflmao2 = "äöõüäöõüäöäöõü";
if(strlen("$roflmao1") > 10){ $roflmao1 = substr($roflmao1, 0, 10) . '...'; } RESULTS: somerandom...
if(strlen("$roflmao2") > 10){$roflmao2 = substr($roflmao2, 0, 10) . '...';} RESULTS: äöõüäöõüä?...
Could anyone provide a solution for this.
Thank you.
For example:
$roflmao1 = "somerandomtext";
$roflmao2 = "äöõüäöõüäöäöõü";
if(strlen("$roflmao1") > 10){ $roflmao1 = substr($roflmao1, 0, 10) . '...'; } RESULTS: somerandom...
if(strlen("$roflmao2") > 10){$roflmao2 = substr($roflmao2, 0, 10) . '...';} RESULTS: äöõüäöõüä?...
Could anyone provide a solution for this.
Thank you.