'; print "doing conversion...\n"; $conv = new ConvertCharset; #print $conv->Convert(rawWiki('wiki:playground'),$enc, 'utf-8', false); $data = array(); //do recursive conversion search($data,$conf['datadir'], 'search_convert', array('conv' => $conv,'enc'=>$enc)); print ''; } function search_convert(&$data,$base,$file,$type,$lvl,$opts){ if($type == 'd'){ return true; }elseif($type == 'f' && !preg_match('#\.txt$#',$file)){ return true; } $from = $base.'/'.$file; $file = $opts['conv']->Convert($file,$opts['enc'],'utf-8',false); $to = $base.'/'.$file; $to = join('/',array_map( 'cleanID', split('/',$to))); //clean each path part $tocl = $to; $to = utf8_encodeFN($to); print "$tocl "; //load old file $raw = io_readFile($from); if(utf8_check($raw)){ print "- skipped\n"; }else{ if(!@unlink($from)){ //delete old file print "- failed (Permissions?)\n"; }else{ //convert to utf8 $utf8 = $opts['conv']->Convert($raw,$opts['enc'],'utf-8',false); //save new file if(io_saveFile($to,$utf8)){ print "- ok\n"; }else{ print "- failed\n"; } } } @set_time_limit(25); //Reset exectimecounter (not in safemode) flush(); return true; } ?>