condense choose_charset with dict