Correctly detect mime type when charset is included