Skip to content

Instantly share code, notes, and snippets.

@smallstyle
Created December 5, 2011 15:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smallstyle/1433903 to your computer and use it in GitHub Desktop.
Save smallstyle/1433903 to your computer and use it in GitHub Desktop.
utf8mb4 support
diff --git a/lib/mysql2/client.rb b/lib/mysql2/client.rb
index 20ed442..8497ca0 100644
--- a/lib/mysql2/client.rb
+++ b/lib/mysql2/client.rb
@@ -87,6 +87,7 @@ module Mysql2
"ucs2" => Encoding::UTF_16BE,
"ujis" => Encoding::EucJP_ms,
"utf8" => Encoding::UTF_8,
+ "utf8mb4" => Encoding::UTF_8,
}
MYSQL_CHARSET_MAP = {
@@ -134,6 +135,7 @@ module Mysql2
42 => {:name => "latin7", :collation => "latin7_general_cs"},
43 => {:name => "macce", :collation => "macce_bin"},
44 => {:name => "cp1250", :collation => "cp1250_croatian_ci"},
+ 45 => {:name => "utf8mb4", :collation => "utf8mb4_general_ci"},
47 => {:name => "latin1", :collation => "latin1_bin"},
48 => {:name => "latin1", :collation => "latin1_general_ci"},
49 => {:name => "latin1", :collation => "latin1_general_cs"},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment