>>548
mb_encode_numericentity($sql, array(0,31,0,0xff) ,"utf8")

そういうSQLの組み立てはやめたほうがいいよ