Refactor out get_email_charset to leap.common