Proper PHP UTF-8 multi-byte operations 21/05/2015 / Web developer / No Comments Have you ever tried handling UTF-8 strings in PHP and everything gets weird with a million questionmarks smashing you on the face? Make sure that you have set UTF-8 to be used by the multibyte PHP5 module as follows: mb_internal_encoding(‘UTF-8’); mb_regex_encoding(‘UTF-8’); You may then use all usual multibyte functions: // Word democracy in greek language. Returns 10. mb_strlen(‘ΔΗΜΟΚΡΑΤΙΑ’); Read more on http://php.net/manual/en/ref.mbstring.php Panagiotis Anastasiadis Software Software, IT Addicted. He has replaced his brain with CUDA cores. Try talking to him in 01010101.
Proper PHP UTF-8 multi-byte operations
Have you ever tried handling UTF-8 strings in PHP and everything gets weird with a million questionmarks smashing you on the face? Make sure that you have set UTF-8 to be used by the multibyte PHP5 module as follows:
You may then use all usual multibyte functions:
Read more on http://php.net/manual/en/ref.mbstring.php
Panagiotis Anastasiadis
Software Software, IT Addicted. He has replaced his brain with CUDA cores. Try talking to him in 01010101.
You might also like
How to easily find infected/hacked files from the command line
How to add a cPanel PHP cron job
Next ArticleHow to add a cPanel PHP cron job