From: Andreas Pflug <Andreas.Pflug@web.de>
To: pgsql-odbc@postgresql.org
To: Dave Page <dpage@vale-housing.co.uk>
Subject: Unicode/client_encoding/conversion problem
Date: Mon, 16 Jun 2003 12:52:27 +0200
Message-ID: <3EEDA16B.1010202@web.de> (raw)
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
Attachments:ResolveOneParam.patch (text/plain, 653B) download
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;
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: Andreas.Pflug@web.de, dpage@vale-housing.co.uk
Subject: Re: Unicode/client_encoding/conversion problem
In-Reply-To: <3EEDA16B.1010202@web.de>
References: <3EEDA16B.1010202@web.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox