add option to specifiy encoding