note 104648 deleted from function.utf8-encode by danbrown
| From: | danbrown@php.net | Date: | Tue, 28 Jun 2011 19:22:35 +0000 |
| Subject: | note 104648 deleted from function.utf8-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181021@lists.php.net to get a copy of this message | ||
Note Submitter: euromark at web dot de
----
@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;
}