rails/rails — pull request #13023 by pwnall (2013-11-24 21:28:00+00:00)
Title: Avoid invalid UTF-8 exception in invalid SQL statement handler.

The mysql connection adapter tries to provide a helpful message for a certain class of invalid SQL statement exceptions. However, if the exception has invalid UTF-8 characters, the handler raises a UTF-8 exception that is not very helpful for debugging.

In most cases, the original message from mysql is very helpful in tracing errors, even if it has binary garbage in it.

Arguably, mysql2 should not create String instances that have invalid UTF-8 encodings. At the same time, I think that the `rescue ''` should clause should still be there to guard the `split` call in the exception handler.