pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow convert UNICODE
6+ messages / 2 participants
[nested] [flat]
* How convert UNICODE
@ 2006-11-17 17:09 lms <piechcio@inetcafe.eu.org>
2006-11-17 21:17 ` Re: How convert UNICODE Drew <drewmwilson@fastmail.fm>
2006-11-17 23:10 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
0 siblings, 2 replies; 6+ messages in thread
From: lms @ 2006-11-17 17:09 UTC (permalink / raw)
To: pgsql-sql
Hello
I have 2 databases with same table. First database is in UNICODE, second in
SQL_ASCII.
4 columns from first database I must convert to:
(first column)iso8859-1,
(second column)iso8859-2,
(3-th column)iso8859-1,
(4 column)iso8859-5.
After it I must save these 4 rows in database in SQL_ASCII.
How can I do it? It can be using libpq,libpgeasy,....
Thx.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How convert UNICODE
2006-11-17 17:09 How convert UNICODE lms <piechcio@inetcafe.eu.org>
@ 2006-11-17 21:17 ` Drew <drewmwilson@fastmail.fm>
2006-11-17 23:00 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
1 sibling, 1 reply; 6+ messages in thread
From: Drew @ 2006-11-17 21:17 UTC (permalink / raw)
To: lms <piechcio@inetcafe.eu.org>; +Cc: pgsql-sql
How about pg_dump the data from your old database, then load it into
your new database which is using UTF8?
Drew
On Nov 17, 2006, at 9:09 AM, lms wrote:
> Hello
> I have 2 databases with same table. First database is in UNICODE,
> second in
> SQL_ASCII.
>
> 4 columns from first database I must convert to:
> (first column)iso8859-1,
> (second column)iso8859-2,
> (3-th column)iso8859-1,
> (4 column)iso8859-5.
>
> After it I must save these 4 rows in database in SQL_ASCII.
> How can I do it? It can be using libpq,libpgeasy,....
>
> Thx.
>
>
> ---------------------------(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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How convert UNICODE
2006-11-17 17:09 How convert UNICODE lms <piechcio@inetcafe.eu.org>
2006-11-17 21:17 ` Re: How convert UNICODE Drew <drewmwilson@fastmail.fm>
@ 2006-11-17 23:00 ` lms <piechcio@inetcafe.eu.org>
0 siblings, 0 replies; 6+ messages in thread
From: lms @ 2006-11-17 23:00 UTC (permalink / raw)
To: pgsql-sql
Hi
New database must be in SQL_ASCII. In old database (UNICODE) are for example
2 columns. Rows from first column I must convert to ISO_8859_2 and insert it
to first column in SQL_ASCII database, and rows from second column I must
convert to IS0_8859_5 and insert to second column in SQL_ASCII database.
On Fri, 17 Nov 2006 13:17:05 -0800, Drew wrote
> How about pg_dump the data from your old database, then load it into
> your new database which is using UTF8?
>
> Drew
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How convert UNICODE
2006-11-17 17:09 How convert UNICODE lms <piechcio@inetcafe.eu.org>
@ 2006-11-17 23:10 ` lms <piechcio@inetcafe.eu.org>
2006-11-19 00:33 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
1 sibling, 1 reply; 6+ messages in thread
From: lms @ 2006-11-17 23:10 UTC (permalink / raw)
To: pgsql-sql
Hi
Yes, but I must convert diffrent columns to diffrent iso-codes.
With pg_dump I can only dump all columns from database and these all columns
convert only to one iso-code.
On Fri, 17 Nov 2006 14:11:25 -0500, Travis Whitton wrote
> There might be better ways, but you could dump the data and use the iconv
utility. I frequently use it to convert to UTF-8 before loading data.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How convert UNICODE
2006-11-17 17:09 How convert UNICODE lms <piechcio@inetcafe.eu.org>
2006-11-17 23:10 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
@ 2006-11-19 00:33 ` lms <piechcio@inetcafe.eu.org>
2006-11-20 18:28 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
0 siblings, 1 reply; 6+ messages in thread
From: lms @ 2006-11-19 00:33 UTC (permalink / raw)
To: pgsql-sql
Hi
I must copy rows from local database (UNICODE) to remote database SQL_ASCII
(not on local machine) with converting selected columns to iso8859_2 or
iso_8859_5. Can I make it with COPY?
On Sat, 18 Nov 2006 09:42:14 -0500, Travis Whitton wrote
> You can use the postgresql COPY command to dump a single column to a file.
Do this for each column you need to convert. From there, use iconv to
convert the data. When you're done dumping and converting, use the unix
paste command to reassemble the data. If you're not on a unix-based
platform, a simple perl script should do the job.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How convert UNICODE
2006-11-17 17:09 How convert UNICODE lms <piechcio@inetcafe.eu.org>
2006-11-17 23:10 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
2006-11-19 00:33 ` Re: How convert UNICODE lms <piechcio@inetcafe.eu.org>
@ 2006-11-20 18:28 ` lms <piechcio@inetcafe.eu.org>
0 siblings, 0 replies; 6+ messages in thread
From: lms @ 2006-11-20 18:28 UTC (permalink / raw)
To: pgsql-sql
Hello
Thanks for help. Iconv is good. Now I use iconv function with libpq.
On Sun, 19 Nov 2006 10:15:53 -0500, Travis Whitton wrote
> Assuming you're on a Unix based platform:
>
> psql> COPY tablename (column1) TO 'column1.csv' WITH CSV;
>
> bash> iconv -f UTF-8 -t iso8859_2 column1.csv > iconv-column1.csv
>
> psql> COPY tablename (column2) TO ' column2.csv' WITH CSV;
>
> bash> iconv -f UTF-8 -t iso8859_5 column2.csv > iconv-column2.csv
>
> repeat for each column...
>
> bash> paste iconv-column* > newtable.csv
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2006-11-20 18:28 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-17 17:09 How convert UNICODE lms <piechcio@inetcafe.eu.org>
2006-11-17 21:17 ` Drew <drewmwilson@fastmail.fm>
2006-11-17 23:00 ` lms <piechcio@inetcafe.eu.org>
2006-11-17 23:10 ` lms <piechcio@inetcafe.eu.org>
2006-11-19 00:33 ` lms <piechcio@inetcafe.eu.org>
2006-11-20 18:28 ` lms <piechcio@inetcafe.eu.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox