X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 446B430DBF5 for ; Wed, 18 Jun 2003 13:21:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47815-07 for ; Wed, 18 Jun 2003 10:21:30 -0300 (ADT) Received: from smtp.web.de (smtp03.web.de [217.72.192.158]) by svr1.postgresql.org (Postfix) with ESMTP id BE11730DBBB for ; Wed, 18 Jun 2003 10:21:29 -0300 (ADT) Received: from p5081848a.dip0.t-ipconnect.de ([80.129.132.138] helo=web.de) by smtp.web.de with asmtp (TLSv1:RC4-MD5:128) (WEB.DE 4.98 #232) id 19ScsO-0006Yr-00; Wed, 18 Jun 2003 15:21:24 +0200 Message-ID: <3EF06762.6010507@web.de> Date: Wed, 18 Jun 2003 15:21:38 +0200 From: Andreas Pflug User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Page Cc: pgsql-odbc@postgresql.org Subject: Re: Unicode/client_encoding/conversion problem References: <03AF4E498C591348A42FC93DEA9661B844B0A0@mail.vale-housing.co.uk> In-Reply-To: <03AF4E498C591348A42FC93DEA9661B844B0A0@mail.vale-housing.co.uk> Content-Type: multipart/mixed; boundary="------------030800070706080802000800" X-Archive-Number: 200306/44 X-Sequence-Number: 3018 This is a multi-part message in MIME format. --------------030800070706080802000800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dave Page wrote: >Thanks, committed with minor fix to close the comment in the correct >place (pls check). > > > Hi Dave, fix hasn't made it correctly into the source. The comment was just to leave the old code for reference. This probably happened because the second fix (ResolveNumeric) would shift the rows of the first fix. There's no switch(param_sqltype) needed, instead all code that's under the 3 case SQL_xxx is to be executed for unicode. Absolutely wrong is the last line "buf=buffer" in the default hieve, because this would override the previous conversion. Attached a new patch file, diff'd from the current cvs. Regards, Andreas --------------030800070706080802000800 Content-Type: text/plain; name="ResolveOneParam.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ResolveOneParam.patch" RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/convert.c,v retrieving revision 1.102 diff -r1.102 convert.c 2561,2565d2560 < /********************* < * it's not correct to convert depending on param_sqltype, < * because the client_encoding is always unicode. < * We need conversion in any case. < */ 2569,2594c2564,2571 < switch (param_sqltype) < { < case SQL_WCHAR: < case SQL_WVARCHAR: < case SQL_WLONGVARCHAR: < 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; < 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; < } --- > 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; --------------030800070706080802000800--