Unicode/client_encoding/conversion problem
От | Andreas Pflug |
---|---|
Тема | Unicode/client_encoding/conversion problem |
Дата | |
Msg-id | 3EEDA16B.1010202@web.de обсуждение исходный текст |
Список | pgsql-odbc |
Hi friends, when a column SQL_C_CHAR is handled in ResolveOneParam, the conversion 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. I wonder if the other direction is handled correctly... A patch is attached. Regards, Andreas RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/convert.c,v retrieving revision 1.99 diff -r1.99 convert.c 2560a2561,2565 > /********************* > * it's not correct to convert depending on param_sqltype, > * because the client_encoding is always unicode. > * We need conversion in any case. > 2577a2583,2594 > > */ > > 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; >
В списке pgsql-odbc по дате отправления: