extracts charset from utf-8 encoded file