Use rb_str_conv_enc_opts to transcode error strings in MySQL < 5.5
Use String.scrub! if available