X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D61B93A3ED8 for ; Tue, 4 Jan 2005 18:20:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88597-03 for ; Tue, 4 Jan 2005 18:20:31 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by svr1.postgresql.org (Postfix) with ESMTP id DC7843A3E8D for ; Tue, 4 Jan 2005 18:20:31 +0000 (GMT) Received: from [212.227.126.206] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1CltIF-00089z-00 for pgsql-odbc@postgresql.org; Tue, 04 Jan 2005 19:20:31 +0100 Received: from [80.129.145.197] (helo=pse-consulting.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1CltIF-0008Pz-00 for pgsql-odbc@postgresql.org; Tue, 04 Jan 2005 19:20:31 +0100 Message-ID: <41DADE6E.2000903@pse-consulting.de> Date: Tue, 04 Jan 2005 18:20:30 +0000 From: Andreas Pflug User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.6) Gecko/20040413 Debian/1.6-5 X-Accept-Language: en MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: conversion problem Content-Type: multipart/mixed; boundary="------------010508030805010808070002" X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/8 X-Sequence-Number: 4803 This is a multi-part message in MIME format. --------------010508030805010808070002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit When trying to insert strings with German umlaute (e.g. "täglich") into a text or varchar column, the server throws the message invalid byte sequence for encoding "UNICODE": 0xe4656c This results from ResolveOneParam not converting the string to UTF-8. From debugging I found that ipdopts->parameters[param_number].SQLType contains 0xffff, instead of something sensible for PGType=0x19 (text). The attached patch works as hotfix for me, but is certainly only a workaround for a problem buried deeper because SQLType seems bogus to me. OTOH, I don't understand why the switch(param_pgtype) was invented at all (the original patch I posted more than a year ago didn't have it), because any string coming from the app will probably need conversion to UTF-8 anyway. Regards, Andreas --------------010508030805010808070002 Content-Type: text/x-patch; name="convert.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="convert.c.patch" Index: convert.c =================================================================== RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/convert.c,v retrieving revision 1.121 diff -u -r1.121 convert.c --- convert.c 30 Jul 2004 21:08:12 -0000 1.121 +++ convert.c 4 Jan 2005 17:49:29 -0000 @@ -2621,6 +2621,7 @@ case SQL_WCHAR: case SQL_WVARCHAR: case SQL_WLONGVARCHAR: + case (Int2)0xffff: if (SQL_NTS == used) used = strlen(buffer); allocbuf = malloc(WCLEN * (used + 1)); --------------010508030805010808070002--