pike.git / lib / modules / Sql.pmod / mysql.pike

version» Context lines:

pike.git/lib/modules/Sql.pmod/mysql.pike:399:   //!   //! @param s   //! String to quote.   string quote(string s)   {    return replace(s,    ({ "\\", "\"", "\0", "\'", "\n", "\r" }),    ({ "\\\\", "\\\"", "\\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, ([    "\x80": "\u20AC", /*"\x81": "\u0081",*/ "\x82": "\u201A", "\x83": "\u0192",    "\x84": "\u201E", "\x85": "\u2026", "\x86": "\u2020", "\x87": "\u2021",    "\x88": "\u02C6", "\x89": "\u2030", "\x8a": "\u0160", "\x8b": "\u2039",    "\x8c": "\u0152", /*"\x8d": "\u008D",*/ "\x8e": "\u017D", /*"\x8f": "\u008F",*/    /*"\x90": "\u0090",*/ "\x91": "\u2018", "\x92": "\u2019", "\x93": "\u201C",    "\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,    function(string, mixed|void...:string) encode_fn,    mixed ... extras)   //! Encodes the appropriate sections of the query with @[encode_fn].   //! Everything except strings prefixed by an introducer (i.e.   //! @expr{_something@} or @expr{N@}) is encoded.   {    // We need to find the segments that shouldn't be encoded.
pike.git/lib/modules/Sql.pmod/mysql.pike:667:    } \    \    else if (send_charset) { \    string new_send_charset = send_charset; \    \    if (utf8_mode & LATIN1_UNICODE_ENCODE_MODE) { \    if (String.width (query) == 8) \    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"; \    } \    } \    \    else { /* utf8_mode & UTF8_UNICODE_ENCODE_MODE */ \    /* NB: The send_charset may only be upgraded from \    * "latin1" to "utf8", not the other way around. \    * This is to avoid extraneous charset changes \    * where the charset is changed from query to query. \    */ \