static public function recursive_iconv($from, $to, &$data)
{
foreach(array_keys($data) as $key) {
$key1 = iconv($from, $to, $key);
if($key1 != $key) {
$data[$key1] = $data[$key];
unset($data[$key]);
}
}
foreach($data as $key => $value) {
if(is_array($value)) {
self::recursive_iconv($from, $to, $data[$key]);
} else {
$data[$key] = iconv($from, $to, $value);
}
}
}
static public function json_encode_cp1251($data)
{
self::recursive_iconv('cp1251', 'utf-8', $data);
return json_encode($data);
}