diff --git a/README.md b/README.md index 72ff37ff0..5e26875d2 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ Mysql2::Client.new( :database, :socket = '/path/to/mysql.sock', :flags = REMEMBER_OPTIONS | LONG_PASSWORD | LONG_FLAG | TRANSACTIONS | PROTOCOL_41 | SECURE_CONNECTION | MULTI_STATEMENTS, - :encoding = 'utf8', + :encoding = 'utf8mb4', :read_timeout = seconds, :write_timeout = seconds, :connect_timeout = seconds, @@ -309,7 +309,7 @@ Use the value `mysql2` as the adapter name. For example: ``` yaml development: adapter: mysql2 - encoding: utf8 + encoding: utf8mb4 database: my_db_name username: root password: my_password diff --git a/lib/mysql2/client.rb b/lib/mysql2/client.rb index 607ad6d6a..31e9e3301 100644 --- a/lib/mysql2/client.rb +++ b/lib/mysql2/client.rb @@ -43,8 +43,8 @@ def initialize(opts = {}) end end - # force the encoding to utf8 - self.charset_name = opts[:encoding] || 'utf8' + # force the encoding to utf8mb4 + self.charset_name = opts[:encoding] || 'utf8mb4' ssl_options = opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslcipher) ssl_set(*ssl_options) if ssl_options.any? || opts.key?(:sslverify)