Home > Archive > PostgreSQL Discussion > September 2005 > COPY and Unicode...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author COPY and Unicode...
Cristian Prieto

2005-09-21, 8:23 pm

Hello, I need to import some amount of data using the COPY command, the main
trouble I found is that the Database is in UNICODE format and the data in
ASCII Latin-1 codepage, when I try to import it, COPY respond with:

ERROR: invalid byte sequence for encoding "UNICODE": 0xe9
CONTEXT: COPY geoip_location, line 307, column city: "Yaound"

I've been looking into the documentation and I could not found any reference
in copy from a distinct codepage than the used by the database, any help?

Thanks a lot!


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Douglas McNaught

2005-09-21, 8:23 pm

"Cristian Prieto" < cristian@clickdiario
.com> writes:

> Hello, I need to import some amount of data using the COPY command, the main
> trouble I found is that the Database is in UNICODE format and the data in
> ASCII Latin-1 codepage, when I try to import it, COPY respond with:
>
> ERROR: invalid byte sequence for encoding "UNICODE": 0xe9
> CONTEXT: COPY geoip_location, line 307, column city: "Yaound"
>
> I've been looking into the documentation and I could not found any reference
> in copy from a distinct codepage than the used by the database, any help?


Are you setting the client_encoding variable before doing the COPY?

-Doug

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Tom Lane

2005-09-21, 8:23 pm

"Cristian Prieto" < cristian@clickdiario
.com> writes:
> Hello, I need to import some amount of data using the COPY command, the main
> trouble I found is that the Database is in UNICODE format and the data in
> ASCII Latin-1 codepage, when I try to import it, COPY respond with:


> ERROR: invalid byte sequence for encoding "UNICODE": 0xe9
> CONTEXT: COPY geoip_location, line 307, column city: "Yaound"


> I've been looking into the documentation and I could not found any reference
> in copy from a distinct codepage than the used by the database, any help?


Try doing "SET client_encoding = latin1" before doing the COPY.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Cristian Prieto

2005-09-21, 8:23 pm

Thanks a lot! Your help was very handy!

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Douglas McNaught
Sent: Miércoles, 21 de Septiembre de 2005 02:39 p.m.
To: Cristian Prieto
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] COPY and Unicode...

"Cristian Prieto" < cristian@clickdiario
.com> writes:

> Hello, I need to import some amount of data using the COPY command, the

main
> trouble I found is that the Database is in UNICODE format and the data in
> ASCII Latin-1 codepage, when I try to import it, COPY respond with:
>
> ERROR: invalid byte sequence for encoding "UNICODE": 0xe9
> CONTEXT: COPY geoip_location, line 307, column city: "Yaound"
>
> I've been looking into the documentation and I could not found any

reference
> in copy from a distinct codepage than the used by the database, any help?


Are you setting the client_encoding variable before doing the COPY?

-Doug

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com