support 1.8.7 (not em)
move out encoding