PHP/MySQL Multibyte Characters

While using PHP to display web pages drawing on a MySQL database, I’ve had some difficulty with strings in non-English characters.  In my case, it happened to be Inuktitut syllabics.  Most text seemed to display properly, but some didn’t.  Ultimately, I found the simple solution, was I needed to enable the “mbstring” extension in PHP, and use functions like “mb_strlen” instead of “strlen”, for various character manipulations I did.
It’s a silly reason to have the error.  I should have realized it earlier, but was thrown off, because most text in the language worked just fine.  So, it didn’t occur that my error was something so big and universal.
I can’t really see any reason not to use the “mbstring” extension, unless you’re guaranteed to stay in English forever.  All I had to do was uncomment the line in PHP.INI that loads it, and then change function names, like “strlen” to “mb_strlen” (there are many such functions).  

Leave a Reply

Your email address will not be published. Required fields are marked *