title: Detect encoding
body: <p>I'm getting some string data from the web, and I suspect that it's not always what it says it is. I don't know where the problem is, and I just don't care any more. From day one on this project I've been fighting Ruby string encoding. I really want some way to say: "Here's a string. What is it?", and then use that data to get it to UTF-8 so that it doesn't explode <code>gsub()</code> 2,000 lines down in the depths of my app. I've checked out <code>rchardet</code>, but even though it supposedly works for 1.9 now, it just blows up given any input with multiple bytes... which is not helpful.</p>