Php does not know about utf-8 by default. It assumes that any string is ASCII, so strtolower converts bytes containing capital letters AZ to lowercase codes az. Since non-ascii-UTF-8 letters are written with two or more bytes, strtolower converts each byte separately, and if the byte contains code equal to the letters AZ, it is converted. As a result, the sequence is interrupted and it no longer matches the correct character.
To change this, you need to configure the mbstring extension:
http://www.php.net/manual/en/book.mbstring.php
to replace strtolower with mb_strtolower or use mb_strtolower direclty. In any case, you need to spend some time to tune the mbstring options to suit your requirements.
SWilk Mar 25 '10 at 14:53 2010-03-25 14:53
source share