I see this a lot and haven\'t figured out a graceful solution. If user input contains invalid byte sequences, I need to be able to have it not raise an exception. For example:<
Since you're using Rails and not just Ruby you can also use tidy_bytes. This works with Ruby 2.0 and also will probably give you back sensible data instead of just replacement characters.