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

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

From: "Nathan M(dot) Davalos" <n(dot)davalos(at)sharedmarketing(dot)com>
To: "PostgreSQL Bugs" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5944: COPY FROM doesn't work with international characters
Date: 2011-03-24 15:48:49
Message-ID: 2701CF596B80DC44815FDBFFF5881A1E0104C33C@exchange01.sharedmarketing.com (view raw or flat)
Thread:
Lists: pgsql-bugs
I just tried it from the psql console and it seems to work, which isn't really an option for us to use since we need to be able to let end users load data via our custom designed database application. None of them would understand or know how to use the console. Currently there's no pressing need to be able to do this for us, so we're just loading the data with a series of insert statements instead of COPY FROM.

testdb=# SET CLIENT_ENCODING TO 'WIN1252';
SET
testdb=# create table tmpintermediate (acnumber character varying(20),acname character varying(50)
);
CREATE TABLE
testdb=# copy tmpintermediate from 'c:\\temp\\thefile.txt';
WARNING:  nonstandard use of \\ in a string literal
LINE 1: copy tmpintermediate from 'c:\\temp\\thefile.txt';
                                  ^
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
COPY 1
testdb=# select * from tmpintermediate;
 acnumber |            acname
----------+------------------------------
 230002   | Alto Desempe±o, S.A. De C.V.
(1 row)

The output is wrong in the select statement from the console, but appears correctly using pgadmin3. I think it's a problem with one if the redistributable libraries instead of postgresql itself. When loading through pgadmin3 or elsewhere the acname field just ends up blank using WIN1252, the COPY FROM will just ignore whatever data is supposed to be loaded into that field when there is an international character.

-----Original Message-----
From: pgsql-bugs-owner(at)postgresql(dot)org [mailto:pgsql-bugs-owner(at)postgresql(dot)org] On Behalf Of Nathan M. Davalos
Sent: Wednesday, March 23, 2011 7:59 PM
To: PostgreSQL Bugs
Subject: Re: [BUGS] BUG #5944: COPY FROM doesn't work with international characters

AcNumber character varying(20),
AcName character varying(50)

The database itself is:
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'English_United States.1252'
       LC_CTYPE = 'English_United States.1252'



-----Original Message-----
From: John R Pierce [mailto:pierce(at)hogranch(dot)com] 
Sent: Wednesday, March 23, 2011 7:54 PM
To: Nathan M. Davalos; PostgreSQL Bugs
Subject: Re: [BUGS] BUG #5944: COPY FROM doesn't work with international characters

On 03/23/11 5:42 PM, Nathan M. Davalos wrote:
> Just in case the reply didn't go through the character in question is F1.
>
> I replied to the message using  pgsql-bugs(at)postgresql(dot)org, but I'm a wee bit new to the bug reporting stuff using the mailing list.
>
> The hex of the file in total is
> 32.33.30.30.30.32.09.41.6C.74.6F.20.44.65.73.65.6D.70.65.F1.6F.2C.20.53.2E.41.2E.20.44.65.20.43.2E.56.2E.0D.0A

k, thats certainly win-1252.  I see a tab after the 230002, then the 
rest of it is all one field, ending in a <CR><LF> sequence.


The table you're copying this data to, what fields does it have?

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

In response to

pgsql-bugs by date

Next:From: Merlin MoncureDate: 2011-03-24 15:54:27
Subject: Re: Can't use WITH in a PERFORM query in PL/pgSQL?
Previous:From: Pavel StehuleDate: 2011-03-24 15:36:31
Subject: Re: Can't use WITH in a PERFORM query in PL/pgSQL?

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