Should I use mb_* or iconv_* functions for multibyte strings?

iconv, multibyte, php, unicode

Solution

Have a look at this Powerpoint presentation:

http://www.nyphp.org/content/presentations/smallworld/April2006-nyphp-Presentation.ppt

In a nutshell: Iconv supports more encodings, but is less portable.

From the presentation:

PHP supports multi byte in two extensions: iconv and mbstring

- iconv uses an external library (supports more encodings but less portable)

- mbstring has the library bundled with PHP (less encodings but more portable)

Problem

As we all now, handling multibyte strings is not that easy in PHP. For example I want to get the length of the following string: `ä` ``` strlen('ä'); // 2, because ä equals 2 bytes mb_strlen('ä', 'UTF-8'); // 1 iconv_strlen('ä', 'UTF-8'); // 1 ``` Which functions should I use? The mb_* or iconv_*? Why? Considering that the encoding may not be limited to UTF-8. Thx in advance!

Original source