note 102368 added to function.utf8-encode

[email protected] Thu, 10 Feb 2011 08:51:59 -0800
Newsgroups php.notes
Message-ID <[email protected]>
I tried a lot of things, but this seems to be the final fail save method to convert any string to proper UTF-8.

<?php
function _convert($content) {
    if(!mb_check_encoding($content, 'UTF-8') 
        OR !($content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {

        $content = mb_convert_encoding($content, 'UTF-8');

        if (mb_check_encoding($content, 'UTF-8')) {
            // log('Converted to UTF-8');
        } else {
            // log('Could not converted to UTF-8');
        }
    }
}
----
Server IP: 69.147.83.197
Probable Submitter: 217.91.146.41
----
Manual Page -- http://www.php.net/manual/en/function.utf8-encode.php
Edit        -- https://master.php.net/note/edit/102368
Del: integrated  -- https://master.php.net/note/delete/102368/integrated
Del: useless     -- https://master.php.net/note/delete/102368/useless
Del: bad code    -- https://master.php.net/note/delete/102368/bad+code
Del: spam        -- https://master.php.net/note/delete/102368/spam
Del: non-english -- https://master.php.net/note/delete/102368/non-english
Del: in docs     -- https://master.php.net/note/delete/102368/in+docs
Del: other reasons-- https://master.php.net/note/delete/102368
Reject      -- https://master.php.net/note/reject/102368
Search      -- https://master.php.net/manage/user-notes.php