/** * Encodes each elements of an array to UTF-8. * * @param array $array * * @return array */ function utf8_encode_array(array $array) { $encoded = []; foreach ($array as $key => $value) { $encoded[$key] = is_array($value) ? utf8_encode_array($value) : utf8_encode($value); } return $encoded; }
/** * Encodes the given array to UTF8 recursively * * @deprecated */ function utf8_encode_array(&$array) { trigger_error('deprecated utf8_encode_array called', E_USER_WARNING); foreach (array_keys($array) as $key) { if ($key === 'dn') { continue; } if ($key === 'jpegPhoto') { continue; } if (is_array($array[$key])) { utf8_encode_array($array[$key]); } else { $array[$key] = utf8_encode($array[$key]); } } }
function utf8_encode_array ( $array ) { $retour = array(); if ( !empty($array) ) { foreach ( $array as $key => $value ) { if ( is_array($value) ) { $retour[$key] = utf8_encode_array($value); } else { if ( is_utf8($value) ) { $retour[$key] = $value; } else { $retour[$key] = utf8_encode($value); } } } } unset($array); return $retour; }
$cliente = $k->FetchRow(); utf8_encode_array($cliente); $int_font = $oo_def; $int_font[ml] = 15; $int_font[mr] = 2; $int_font[name] = 'Arial12int'; $OO_TEXT .= print_text("\n\n" . EXPORT_SXW_DEST . ":\n\n" . "{$cliente['nome']}\n" . "{$cliente['indirizzo']}\n" . "{$cliente['cap']} {$cliente['citta']}\n", $int_font); } // create table new_table(get_default_table('Tabella1', array(4, 9, 8))); add_table_header('Tabella1', array(EXPORT_SXW_COD, EXPORT_SXW_DENOM, EXPORT_SXW_NTEL), make_bold($oo_def_c)); $where = implode(' AND ', $wh); $TIPI = array(1 => 'AVVR', 2 => 'CLIE', 3 => 'COLL', 4 => 'CONS', 5 => 'CORR', 6 => 'FORN'); $q = $DB->Execute(" SELECT * \r\n FROM contact \r\n WHERE {$where}\r\n ORDER BY codice ASC"); while ($l = $q->FetchRow()) { utf8_encode_array($l); if ($l[data] == '0000-00-00') { $l[data] = ''; } add_table_row('Tabella1', array($l[codice], $rapida ? $l[nome] : "{$l['nome']}\n" . "{$l['indirizzo']}\n" . "{$l['cap']}\t{$l['citta']}\n" . "{$l['stato']}\t- {$l['leg_rap']}\n" . EXPORT_SXW_TYPE . ": " . $TIPI[$l[tipo]] . "\n" . EXPORT_SXW_DCOST . ": {$l['data']} - {$l['luogo']}", $rapida ? $l[telefono] : "{$l['telefono']}\n" . EXPORT_SXW_FAX . ":\t{$l['fax']}\n" . EXPORT_SXW_CFIS . "\t{$l['cod_fis']}\n" . EXPORT_SXW_PIVA . "\t{$l['piva']}\n" . EXPORT_SXW_ISCRCIAAA . ": {$l['iscr_ccia']}\n" . EXPORT_SXW_ISCRTRIB . ": {$l['iscr_trib']}\n" . EXPORT_SXW_PERSFIS . ": " . ($l[tipo_contatto] ? EXPORT_SXW_PERSFIS_NO : EXPORT_SXW_PERSFIS_YES) . "\n"), array($oo_def, $oo_def, $oo_def)); // note if ($l[note] && in_array(1, $P[print_note]) && !$rapida) { add_table_row('Tabella1', array(EXPORT_SXW_NOTE . ": " . $l[note]), $oo_def); } } // create content $OO_PAGE_STYLE = set_page_style($PAGE_STYLE); $OO_PAGE_HEADER = set_page_header("#DATA#\t\t\t" . EXPORT_SXW_TIT_ANA . "\t\t" . EXPORT_SXW_TIT_PG . ": #PAGINA#"); $OO_PAGE_FOOTER = ''; // set_page_footer('#DATA# #ORA#'); $header_style = array(color => '#000000', size => '12pt', align => 'start', face => 'Verdana');
/** * Encdes the data t UTF-8. * * @param array $data * * @return array */ private function encode($data = []) { return utf8_encode_array($data); }
/** * @param \Domynation\Http\Route $route * @param array $inputs */ private function doLog(Route $route, array $inputs) { $data = ['user' => ['id' => $this->user->getId(), 'name' => $this->user->getFullName()], 'route' => ['name' => $route->getName(), 'inputs' => $inputs]]; $this->logger->info("Route: ", utf8_encode_array($data)); }
public function update($index, $type, $documentId, $data) { $this->client->index(['index' => $index, 'type' => $type, 'id' => $documentId, 'body' => utf8_encode_array($data)]); }
function utf8_encode_array($Data) { // Recursively loop array to encode values. if (!is_array($Data)) { return utf8_encode($Data); } else { foreach ($Data as $key => $val) { $Data[$key] = utf8_encode_array($val); } return $Data; } }