is coded dependent on param_sqltype. If a SQL_CHAR variable is bound to
it, no conversion takes place, which is incorrect. ODBC architecture
assumes sqltype to be the server_encoding, but this is irrelevant for
pgsql. Instead, everything is done with client_encoding (anything but
UNICODE doesn't make sense here), so we need a conversion to UTF-8 in
any case.
[Andreas Pflug]
case SQL_C_BINARY:
buf = buffer;
break;
+/*********************
+ * it's not correct to convert depending on param_sqltype,
+ * because the client_encoding is always unicode.
+ * We need conversion in any case.
+
case SQL_C_CHAR:
#ifdef WIN_UNICODE_SUPPORT
switch (param_sqltype)
allocbuf = buf;
break;
default:
+
+*/
+
+ if (SQL_NTS == used)
+ used = strlen(buffer);
+ allocbuf = malloc(2 * (used + 1));
+ used = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, buffer,
+ used, (LPWSTR) allocbuf, used + 1);
+ buf = ucs2_to_utf8((SQLWCHAR *) allocbuf, used, &used);
+ free(allocbuf);
+ allocbuf = buf;
+
buf = buffer;
}
#else