pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: bartek@mikronika.com.pl
To: pgsql-odbc@postgresql.org
Subject: Invalid byte sequence for encoding "UTF8": 0xa1 - when insert data into bytea.
Date: Tue, 12 Dec 2006 16:23:57 +0100 (CET)
Message-ID: <16562.192.168.3.191.1165937037.squirrel@www2> (raw)

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=================================
inline patch 1: popr/convert.c (+9/-0 lines) download inline-1.patch--- 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 { =========================================================

view thread (5+ messages)  latest in thread

Message-ID: <16562.192.168.3.191.1165937037.squirrel@www2>
Permalink:  ../16562.192.168.3.191.1165937037.squirrel@www2/
Also on:    postgresql.org/message-id/16562.192.168.3.191.1165937037.squirrel@www2

 ·  · 

reply

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: bartek@mikronika.com.pl
  Subject: Re: Invalid byte sequence for encoding "UTF8": 0xa1 - when insert data into bytea.
  In-Reply-To: <16562.192.168.3.191.1165937037.squirrel@www2>
  References: <16562.192.168.3.191.1165937037.squirrel@www2>

* 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