diff --git a/lib/modules/Mysql.pmod/SqlTable.pike b/lib/modules/Mysql.pmod/SqlTable.pike index 9aa48a8928f319de04db76f5086b5e8c4fb58b7c..aca006f4c972976550a33d675856ffe05085b542 100644 --- a/lib/modules/Mysql.pmod/SqlTable.pike +++ b/lib/modules/Mysql.pmod/SqlTable.pike @@ -1438,7 +1438,7 @@ protected void add_mysql_value (String.Buffer buf, string col_name, mixed val) // FIXME: If the column holds binary data we should throw an // error here instead of sending what is effectively garbled // data. - buf->add ("_utf8\"", string_to_utf8 (quote (val)), "\""); + buf->add ("_utf8\"", string_to_utf8 (quote (val), 2), "\""); } else if (intp (val)) { if (zero_type (val)) diff --git a/lib/modules/Sql.pmod/mysql.pike b/lib/modules/Sql.pmod/mysql.pike index 506f0adeacf5552202871bb5363b502d023489a9..63ba5909739d1aaae86e0bfeeb78d14e42eb7a6c 100644 --- a/lib/modules/Sql.pmod/mysql.pike +++ b/lib/modules/Sql.pmod/mysql.pike @@ -406,7 +406,7 @@ string quote(string s) ({ "\\\\", "\\\"", "\\0", "\\\'", "\\n", "\\r" })); } -string latin1_to_utf8 (string s) +string latin1_to_utf8 (string s, int extended) //! Converts a string in MySQL @expr{latin1@} format to UTF-8. { return string_to_utf8 (replace (s, ([ @@ -418,7 +418,7 @@ string latin1_to_utf8 (string s) "\x94": "\u201D", "\x95": "\u2022", "\x96": "\u2013", "\x97": "\u2014", "\x98": "\u02DC", "\x99": "\u2122", "\x9a": "\u0161", "\x9b": "\u203A", "\x9c": "\u0153", /*"\x9d": "\u009D",*/ "\x9e": "\u017E", "\x9f": "\u0178", - ]))); + ])), extended); } string utf8_encode_query (string q, @@ -674,7 +674,7 @@ int decode_datetime (string timestr) new_send_charset = "latin1"; \ else { \ CH_DEBUG ("Converting (mysql-)latin1 query to utf8.\n"); \ - query = utf8_encode_query (query, latin1_to_utf8); \ + query = utf8_encode_query (query, latin1_to_utf8, 2); \ new_send_charset = "utf8"; \ } \ } \