On Wed, 30 Aug 2006 18:34:20 +0700 "Peter Lauri" <lists@xxxxxxxxxxx> wrote: > 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. The last byte of a UTF-8 character does not have bit 8 set whereas all preceeding bytes do. Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php