BUG #5944: COPY FROM doesn't work with international characters

From: "Nathan Davalos" <n(dot)davalos(at)sharedmarketing(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5944: COPY FROM doesn't work with international characters
Date: 2011-03-23 23:32:58
Message-ID: 201103232332.p2NNWwRn083987@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5944
Logged by: Nathan Davalos
Email address: n(dot)davalos(at)sharedmarketing(dot)com
PostgreSQL version: 9
Operating system: Windows XP/2003
Description: COPY FROM doesn't work with international characters
Details:

I'm trying to load a tab delimited text file with COPY FROM under version
9.

create table tmpintermediate (
AcNumber character varying(20),
AcName character varying(50));

SET CLIENT_ENCODING TO 'WIN1251';
copy tmpintermediate from 'thefile.txt';

Sample contents of thefile:
230002 Alto Desempeño, S.A. De C.V.

When using WIN1251 or WIN1252 I get nothing in the second field, it just
ignores the data. Same thing for LATIN-1.

When using UTF8 for client encoding I get this message:
ERROR: invalid byte sequence for encoding "UTF8": 0xf16f2c20
CONTEXT: COPY tmpintermediate , line 1

Not sure what the problem is, I assumed encoding the database as UTF8 would
just take any character. Inserting the data with an insert statement works
perfectly normal. Is it something I'm doing wrong with COPY FROM?

The database is UTF8, in 8.3 we were using WIN1252 for the database
encoding, but when we migrated to 8.4 everything was forced to UTF8
regardless of what the locale was specified during install using pg_dumpall
to migrate the data, so I just left things as UTF8. Not sure how to proceed
with this one. We create all our databases using a customized template
datatabase (we leave the ones that install with postgresql intact and
untouched).

The copy commands are being issued by pgadmin3 if that makes any difference.
That and we use MicroOlap's PosgresDAC components for Delphi.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2011-03-23 23:49:03 Re: BUG #5944: COPY FROM doesn't work with international characters
Previous Message Daniel Ceregatti 2011-03-23 23:01:59 BUG #5943: jdbc client doesn't omit pg_toast_temp tables from schema views