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-ow...@postgresql.org [mailto:pgsql-bugs-ow...@postgresql.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:pie...@hogranch.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@postgresql.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Reply via email to