Corrupted strings when using strtolower()17 Aug 2010
Little blog post at 5am, I'll try to make it very short, I need some sleep.
To avoid getting corrupted string results when calling
strings, you can call
mb_strtolower instead. The
mb_* functions are aware
of the utf8 encoding.
Unfortunatly, sometime you just can't, because the call is made in the cakePHP
Inflector). Defining a
CTYPElocale for your whole app may be a
Just add a
setlocale(LC_CTYPE, 'C'); in your app and all your utf8 strings
will correctly work with string functions.
Just note that on Windows, calling
setlocale will change the locale for all
threads, not just the one where PHP is running. This may cause unexpected
Want to add something ? Feel free to get in touch on Twitter : @pixelastic