Handling charsets when looking up extensions