note 89789 deleted from function.utf8-encode by cmb
| From: | cmb@php.net | Date: | Fri, 26 Oct 2018 20:21:24 +0000 |
| Subject: | note 89789 deleted from function.utf8-encode by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209531@lists.php.net to get a copy of this message | ||
Note Submitter: mrezair at azarbod dot com
----
I found this little function very useful in fixing strings that are not in utf-8 but need be
converted
<?php
// Fixes the encoding to uf8
function fixEncoding($in_str)
{
$cur_encoding = mb_detect_encoding($in_str) ;
if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8"))
return $in_str;
else
return utf8_encode($in_str);
} // fixEncoding
?>