note 89789 modified in function.utf8-encode by danbrown
| From: | danbrown@php.net | Date: | Mon, 23 Mar 2009 18:24:20 +0000 |
| Subject: | note 89789 modified in function.utf8-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152339@lists.php.net to get a copy of this message | ||
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
?>
--was--
I found this little function very useful in fixing strings that are not in utf-8 but need be
converted
// 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
http://php.net/manual/en/function.utf8-encode.php