Permalink
Browse files

fixing unicode bug

  • Loading branch information...
1 parent 839cbc3 commit f0669045bf38115e19881bf412778076971cb85b Jacob Vorreuter committed Dec 14, 2009
Showing with 3 additions and 3 deletions.
  1. +2 −2 src/emysql_conn.erl
  2. +1 −1 src/emysql_util.erl
View
@@ -42,7 +42,7 @@ set_encoding(Connection, Encoding) ->
emysql_tcp:send_and_recv_packet(Connection#connection.socket, Packet, 0).
execute(Connection, Query, []) when is_list(Query); is_binary(Query) ->
- Packet = <<?COM_QUERY, (unicode:characters_to_binary(Query))/binary>>,
+ Packet = <<?COM_QUERY, (iolist_to_binary(Query))/binary>>,
emysql_tcp:send_and_recv_packet(Connection#connection.socket, Packet, 0);
execute(Connection, StmtName, []) when is_atom(StmtName) ->
@@ -74,7 +74,7 @@ execute(Connection, StmtName, Args) when is_atom(StmtName), is_list(Args) ->
end.
prepare(Connection, Name, Statement) ->
- Packet = <<?COM_QUERY, "PREPARE ", (atom_to_binary(Name, utf8))/binary, " FROM '", (unicode:characters_to_binary(Statement))/binary, "'">>,
+ Packet = <<?COM_QUERY, "PREPARE ", (atom_to_binary(Name, utf8))/binary, " FROM '", (iolist_to_binary(Statement))/binary, "'">>,
emysql_tcp:send_and_recv_packet(Connection#connection.socket, Packet, 0).
unprepare(Connection, Name) ->
View
@@ -158,7 +158,7 @@ encode(Val, false) when is_binary(Val) ->
encode(Val, true) when is_binary(Val) ->
quote(Val);
encode(Val, true) ->
- unicode:characters_to_binary(encode(Val,false));
+ list_to_binary(encode(Val,false));
encode(Val, false) when is_atom(Val) ->
quote(atom_to_list(Val));
encode(Val, false) when is_list(Val) ->

0 comments on commit f066904

Please sign in to comment.