We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26f66c3 commit cd089e9Copy full SHA for cd089e9
lib/mysql2/error.rb
@@ -3,7 +3,7 @@
3
module Mysql2
4
class Error < StandardError
5
REPLACEMENT_CHAR = '?'
6
- ENCODE_OPTS = {:undef => :replace, :invalid => :replace}
+ ENCODE_OPTS = {:undef => :replace, :invalid => :replace, :replace => REPLACEMENT_CHAR}
7
8
attr_accessor :error_number, :sql_state
9
attr_writer :server_version
@@ -60,7 +60,7 @@ def clean_message(message)
60
message.encode(ENCODE_OPTS)
61
else
62
if message.respond_to? :scrub
63
- message.scrub.encode(ENCODE_OPTS)
+ message.scrub(REPLACEMENT_CHAR).encode(ENCODE_OPTS)
64
65
# This is ugly as hell but Ruby 1.9 doesn't provide a way to clean a string
66
# and retain it's valid UTF-8 characters, that I know of.
0 commit comments