note 89789 added to function.utf8-encode
| From: | mrezair at azarbod dot com | Date: | Mon, 23 Mar 2009 18:19:14 +0000 |
| Subject: | note 89789 added to function.utf8-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152338@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
// 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
----
Server IP: 66.207.199.35
Probable Submitter: 70.48.113.185
----
Manual Page -- http://www.php.net/manual/en/function.utf8-encode.php
Edit -- https://master.php.net/note/edit/89789
Del: integrated -- https://master.php.net/note/delete/89789/integrated
Del: useless -- https://master.php.net/note/delete/89789/useless
Del: bad code -- https://master.php.net/note/delete/89789/bad+code
Del: spam -- https://master.php.net/note/delete/89789/spam
Del: non-english -- https://master.php.net/note/delete/89789/non-english
Del: in docs -- https://master.php.net/note/delete/89789/in+docs
Del: other reasons-- https://master.php.net/note/delete/89789
Reject -- https://master.php.net/note/reject/89789
Search -- https://master.php.net/manage/user-notes.php