note 89316 added to function.utf8-decode

From: Date: Tue, 03 Mar 2009 13:36:34 +0000
Subject: note 89316 added to function.utf8-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-151385@lists.php.net to get a copy of this message
Just a note to the function posted by haugas at gmail dot com: A script using this function seemed to hang for a reason not immediately clear. It appeared that the string that was being parsed contained an odd character that caused an eternal loop. Therefore you might want to provide an escape route: function _utf8_decode($string) { $tmp = $string; $count = 0; while (mb_detect_encoding($tmp) == "UTF-8") { $tmp = utf8_decode($tmp); $count++; if ($count > 25) { return $string; } } for ($i = 0; $i < $count - 2 ; $i++) { $string = utf8_decode($string); } return $string; } ---- Server IP: 89.248.170.61 Probable Submitter: 145.18.162.34 ---- Manual Page -- http://www.php.net/manual/en/function.utf8-decode.php Edit -- https://master.php.net/note/edit/89316 Del: integrated -- https://master.php.net/note/delete/89316/integrated Del: useless -- https://master.php.net/note/delete/89316/useless Del: bad code -- https://master.php.net/note/delete/89316/bad+code Del: spam -- https://master.php.net/note/delete/89316/spam Del: non-english -- https://master.php.net/note/delete/89316/non-english Del: in docs -- https://master.php.net/note/delete/89316/in+docs Del: other reasons-- https://master.php.net/note/delete/89316 Reject -- https://master.php.net/note/reject/89316 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151385) next »