pike.git
/
lib
/
modules
/
Sql.pmod
/
mysql.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/mysql.pike:1:
/*
-
* $Id: mysql.pike,v 1.
21
2006/09/
15
14
:
28
:
02
mast Exp $
+
* $Id: mysql.pike,v 1.
22
2006/09/
18
16
:
05
:
18
mast Exp $
* * Glue for the Mysql-module */ //! Implements the glue needed to access the Mysql-module from the generic //! SQL module. #pike __REAL_VERSION__ #if constant(Mysql.mysql)
pike.git/lib/modules/Sql.pmod/mysql.pike:321:
{ return replace(s, ({ "\\", "\"", "\0", "\'", "\n", "\r" }), ({ "\\\\", "\\\"", "\\0", "\\\'", "\\n", "\\r" })); } string latin1_to_utf8 (string s) //! 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
",
+
"\x80": "
\x20AC
", /*"\x81": "
\x0081
",*/ "\x82": "
\x201A
", "\x83": "
\x0192
",
+
"\x84": "
\x201E
", "\x85": "
\x2026
", "\x86": "
\x2020
", "\x87": "
\x2021
",
+
"\x88": "
\x02C6
", "\x89": "
\x2030
", "\x8a": "
\x0160
", "\x8b": "
\x2039
",
+
"\x8c": "
\x0152
", /*"\x8d": "
\x008D
",*/ "\x8e": "
\x017D
", /*"\x8f": "
\x008F
",*/
+
/*"\x90": "
\x0090
",*/ "\x91": "
\x2018
", "\x92": "
\x2019
", "\x93": "
\x201C
",
+
"\x94": "
\x201D
", "\x95": "
\x2022
", "\x96": "
\x2013
", "\x97": "
\x2014
",
+
"\x98": "
\x02DC
", "\x99": "
\x2122
", "\x9a": "
\x0161
", "\x9b": "
\x203A
",
+
"\x9c": "
\x0153
", /*"\x9d": "
\x009D
",*/ "\x9e": "
\x017E
", "\x9f": "
\x0178
",
]))); } string utf8_encode_query (string q, function(string:string) encode_fn) //! 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. string e = "";