Detect encoding and reencode in utf-8