Try to detect encodings and re-encode automatically