Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8CE879F9398 for ; Tue, 12 Dec 2006 11:48:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 32459-05 for ; Tue, 12 Dec 2006 11:48:53 -0400 (AST) X-Greylist: delayed 00:25:34.998672 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 41B809FA381 for ; Tue, 12 Dec 2006 11:48:42 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from cluster2.mikronika.com.pl (ro.mikronika.com.pl [213.17.224.85]) by svr4.postgresql.org (Postfix) with ESMTP id F33B55AF88E for ; Tue, 12 Dec 2006 15:23:05 +0000 (GMT) Received: from www2 (sigma [192.168.0.164]) by cluster2.mikronika.com.pl (8.13.4/8.13.4) with ESMTP id kBCFNvFN009526 for ; Tue, 12 Dec 2006 16:23:57 +0100 Received: from 192.168.3.191 (SquirrelMail authenticated user bartek) by www2 with HTTP; Tue, 12 Dec 2006 16:23:57 +0100 (CET) Message-ID: <16562.192.168.3.191.1165937037.squirrel@www2> Date: Tue, 12 Dec 2006 16:23:57 +0100 (CET) Subject: Invalid byte sequence for encoding "UTF8": 0xa1 - when insert data into bytea. From: bartek@mikronika.com.pl To: pgsql-odbc@postgresql.org User-Agent: SquirrelMail/1.5.1 [CVS] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.962 tagged_above=0 required=5 tests=BAYES_50, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200612/45 X-Sequence-Number: 8492 Invalid byte sequence for encoding "UTF8": 0xa1 - when insert data into bytea. PostgreSQL: 8.1.5 Driver: psqlodbc-08.01.0200 Database in UTF-8. Local encoding: LC_ALL=pl_PL.ISO-8859-2 In " convert_to_pgbinary" : isalnum(0xa1) return true for pl_PL.ISO-8859-2 but it isn't ascii character and should be convert to octal. Solution: ======================diff_file================================= --- oryg/convert.c 2006-01-08 11:09:52.000000000 +0100 +++ popr/convert.c 2006-12-05 11:24: 20.000000000 +0100 @@ -3709,6 +3709,15 @@ } +BOOL myisalnum(UCHAR c) +{ + if(isalnum(c) && c <128) + return TRUE; + + return FALSE; +} + + /* convert non-ascii bytes to octal escape sequences */ int convert_to_pgbinary(const UCHAR *in, char *out, int len) @@ -3719,7 +3728,7 @@ for (i = 0; i < len; i++) { mylog("convert_to_pgbinary: in[%d] = %d, %c\n", i, in[i], in[i]); - if (isalnum(in[i]) || in[i] == ' ') + if (myisalnum(in[i]) || in[i] == ' ') out[o++] = in[i]; else { =========================================================