Invalid byte sequence for encoding "UTF8": 0xa1 - when insert data into bytea.

Invalid byte sequence for encoding "UTF8": 0xa1 - when insert data into bytea.

am 12.12.2006 16:23:57 von bartek

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=3Dpl_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_fi=
le===================3D= 3D=====
=========3D
--- 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 =3D 0; i < len; i++)
{
mylog("convert_to_pgbinary: in[%d] =3D %d, %c\n", i, in[i=
],
in[i]);
- if (isalnum(in[i]) || in[i] == ' ')
+ if (myisalnum(in[i]) || in[i] == ' ')
out[o++] =3D in[i];
else
{
==================== =====3D=
==================== =====3D=
=======3D




---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Re: Invalid byte sequence for encoding "UTF8": 0xa1 - when

am 13.12.2006 04:29:27 von Hiroshi Inoue

bartek@mikronika.com.pl wrote:
> 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

Looking at the manual page I found it can be true.

> and should be convert to octal.

I would take care of it.
Thanks.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Re: Invalid byte sequence for encoding "UTF8": 0xa1 - when

am 18.12.2006 07:42:45 von Hiroshi Inoue

Hiroshi Inoue wrote:
> bartek@mikronika.com.pl wrote:
>> 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
>
> Looking at the manual page I found it can be true.
>
> > and should be convert to octal.
>
> I would take care of it.
> Thanks.

Please try the snapshot dll at
http://www.geocities.jp/inocchichichi/psqlodbc/index.html
..

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend