function utf8($str) { return (mb_detect_encoding($str)=='UTF-8')?$str:utf8_encode($str); }