Permalink
Browse files

set character-set=utf8 when connection initialize

  • Loading branch information...
1 parent 53d5fed commit e423981a96800cd3f59a10c0d89f98f3acca5a94 @at-grandpa committed Nov 4, 2016
Showing with 4 additions and 0 deletions.
  1. +1 −0 src/mysql/connection.cr
  2. +3 −0 src/mysql/ext.cr
@@ -9,6 +9,7 @@ module MySQL
class Connection
def initialize
@handle = LibMySQL.init(Pointer(LibMySQL::MySQL).null)
+ LibMySQL.set_character_set(@handle, "utf8")
@connected = false
end
View
@@ -245,4 +245,7 @@ lib LibMySQL
fun close = mysql_close(m : MySQL*) : Void
+ # Set the character set
+
+ fun set_character_set = mysql_set_character_set(mysql : MySQL*, stmt_str : UInt8*) : Int16
end

0 comments on commit e423981

Please sign in to comment.