auto encoding

If encoding is not specified this PR can choose the best one for you