$value){ $elem[$key] = self::utf8_decode($value); } }else if(is_object($elem)){ $elem = self::obj2array($elem); $elem = self::utf8_decode($elem); }else{ $elem = utf8_decode($elem); } return $elem; } protected static function utf8_encode($elem){ if(is_array($elem)){ foreach ($elem as $key =>$value){ $elem[$key] = self::utf8_encode($value); } }else if(is_object($elem)){ $elem = self::obj2array($elem); $elem = self::utf8_encode($elem); }else{ $elem = utf8_encode($elem); } return $elem; } public static function utf8_normalize($elem,$tranform='encode'){ global $charset; if($charset != "utf-8"){ if($tranform=='encode'){ return self::utf8_encode($elem); }elseif($tranform=='decode'){ return self::utf8_decode($elem); }else{ return $elem; } }else{ return $elem; } } protected static function obj2array($obj){ $array = array(); if(is_object($obj)){ foreach($obj as $key => $value){ if(is_object($value)){ $value = self::obj2array($value); } $array[$key] = $value; } }else{ $array = $obj; } return $array; } } // end of onto_root_ui