Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

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

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

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

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


pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group