in reply to What's the best way to detect character encodings, Windows-1252 v. UTF-8?

You can just try to decode it as UTF-8, and fall back to cp-1252 if it didn't work. See Encode, section "Handling Malformed Data".
  • Comment on Re: What's the best way to detect character encodings, Windows-1252 v. UTF-8?