iconvArray

Функция преобразования кодировки с обходом

iconvArray.php
private function iconvArray($arData, $charset_from, $charset_to) {
  $arTmp = array();
  foreach($arData as $k => $_v)
  {
    if(is_array($_v)) {
      $v = $this->iconvArray($_v, $charset_from, $charset_to);
    } else {
      $v = iconv($charset_from, $charset_to.'//IGNORE', $_v);
      if(empty($v)) $v = iconv($charset_from, $charset_to.'//TRANSLIT', $_v);
    }
    $k = iconv($charset_from, $charset_to.'//IGNORE', $k);
    $arTmp[$k] = $v;
  }
  return $arTmp;
}