Wednesday April 16, 2008

UTF-8 in LAMP

Software

Here's a handy function returning an array of UTF-8 characters associated to a simple ASCII character. Can be useful when offering users an interface to browse by first character (0-9, A-Z) while actual data retrieval should obviously also include entries starting with a special character.

For example, browsableUtf8Characters("e") returns an array containing e. è, é, ê and ë which can easily be joined and then used in SQL like-queries.

Download browsableUtf8Characters.php or view the source first. (License: none really, enjoy!)


© Copyright 1995-2008 Robert John Kaper. All rights reserved.

Tom has more friends but mine are prettier! (#1/1)