note 104648 added to function.utf8-encode

From: Date: Tue, 28 Jun 2011 10:30:25 +0000
Subject: note 104648 added to function.utf8-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-181013@lists.php.net to get a copy of this message
@bastian aren't you missing the vital part? you need the same for the values, as well. otherwise you still end up with messed up data! so more like function _encode(array $array) { $convertedArray = array(); foreach($array as $key => $value) { if(!mb_check_encoding($key, 'UTF-8')) $key = utf8_encode($key); if(is_array($value)) $value = $this->_encode($value); if(!mb_check_encoding($value, 'UTF-8')) $value = utf8_encode($value); $convertedArray[$key] = $value; } return $convertedArray; } ---- Server IP: 69.147.83.197 Probable Submitter: 92.231.40.16 ---- Manual Page -- http://www.php.net/manual/en/function.utf8-encode.php Edit -- https://master.php.net/note/edit/104648 Del: integrated -- https://master.php.net/note/delete/104648/integrated Del: useless -- https://master.php.net/note/delete/104648/useless Del: bad code -- https://master.php.net/note/delete/104648/bad+code Del: spam -- https://master.php.net/note/delete/104648/spam Del: non-english -- https://master.php.net/note/delete/104648/non-english Del: in docs -- https://master.php.net/note/delete/104648/in+docs Del: other reasons-- https://master.php.net/note/delete/104648 Reject -- https://master.php.net/note/reject/104648 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181013) next »