substr and UTF-8
| From: | Peter Lauri | Date: | Wed, 30 Aug 2006 11:34:20 +0000 |
| Subject: | substr and UTF-8 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-241219@lists.php.net to get a copy of this message | ||
Hi group,
I want to limit the number of characters that are shown in a script. The
characters happen to be Thai, and the page is encoded in UTF-8. Everything
works, except when I want to cut the text (just take start of string).
I do:
echo substr($thaistring, 0, 30);
The beginning of the string works fine, but the last character does mostly
"break". How can I determine the start and end of a character.
I hope the problem is clear enough, is it? :)
Best regards,
Peter Lauri
www.lauri.se - personal web site
www.dwsasia.com - company web site