Yngvarr

Generation

generate functionTue, 21 Mar 2023

convert file to utf8

function convert_to_utf8_recursively($dat) { if (is_string($dat)) { return mb_convert_encoding($dat, 'UTF-8', 'UTF-8'); } elseif (is_array($dat)) { $ret = array(); foreach ($dat as $i => $d) $ret[ $i ] = convert_to_utf8_recursively($d); return $ret; } elseif (is_object($dat)) { foreach ($dat as $i => $d) $dat->$i = convert_to_utf8_recursively($d); return $dat; } else { return $dat; } }

Questions about programming?Chat with your personal AI assistant