//编码格式转换
function format_C($gg,$uu,$arr){
format_change($gg, $uu,$arr,true);
return $arr;
}
function format_change($gg,$uu,&$arr,$apply_to_keys = false){
static $aa_counter=0;
if(++$aa_counter>6){
die('possible deep attack');
}
foreach($arr as $key=>$value){
if(is_array($value)){
format_change($gg,$uu,$arr[$key],true);
}else{
$arr[$key] = iconv($gg,$uu,$value);
}
if($apply_to_keys && is_string($key)){
$new_key = iconv($gg,$uu,$key);
if($new_key!=$key){
$arr[$new_key] = $arr[$key];
unset($arr[$key]);
}
}
}
$aa_counter--;
}
function format_C($gg,$uu,$arr){
format_change($gg, $uu,$arr,true);
return $arr;
}
function format_change($gg,$uu,&$arr,$apply_to_keys = false){
static $aa_counter=0;
if(++$aa_counter>6){
die('possible deep attack');
}
foreach($arr as $key=>$value){
if(is_array($value)){
format_change($gg,$uu,$arr[$key],true);
}else{
$arr[$key] = iconv($gg,$uu,$value);
}
if($apply_to_keys && is_string($key)){
$new_key = iconv($gg,$uu,$key);
if($new_key!=$key){
$arr[$new_key] = $arr[$key];
unset($arr[$key]);
}
}
}
$aa_counter--;
}