Revision: 69489
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 29, 2015 22:45 by fackz
Initial Code
if (preg_match('!!u', $string)) { // this is utf-8 } else { // definitely not utf-8 }
Initial URL
Initial Description
I can't say I can rely on mb_detect_encoding(). Had some freaky false positives a while back. The following code will detect when you need to enconde or decode it.
Initial Title
Detect and convert utf-8 on string
Initial Tags
convert
Initial Language
PHP