Move parsing of encoding names to a single place