auto encoding detect