Re: Problem while restoring a database from SQL_ASCII to UTF-8

From: "Manoj Agarwal" <ma(at)ockham(dot)be>
To: "'Adrian Klaver'" <adrian(dot)klaver(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem while restoring a database from SQL_ASCII to UTF-8
Date: 2012-06-08 09:30:15
Message-ID: 000a01cd4559$51dc2440$f5946cc0$@ockham.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I took a slightly different approach to fix the issue. There is a CPAN
module called Encoding::FixLatin, that takes mixed encoding input and
produces UTF-8 output. It can be downloaded from the following link:

http://search.cpan.org/dist/Encoding-FixLatin/lib/Encoding/FixLatin.pm

This module takes input which may contain characters in more than one
encoding and makes a best effort to convert them all to UTF-8 output. I
took the dump from Postgresql 7.4.19 database where encoding was SQL_ASCII.
Then I created a new database in UTF-8 in Postgresql 8.4.9. Then I
installed the above Perl module. After installing the module, I used the
following command to restore SQL_ASCII database to UTF-8:
pg_restore -O db_dump_sql_ascii | fix_latin | psql -d db_utf

The conversion was done successfully without any errors. The database was
restored as UTF-8.

Kind Regards,
Manoj Agarwal

-----Original Message-----
From: Adrian Klaver [mailto:adrian(dot)klaver(at)gmail(dot)com]
Sent: Friday, June 08, 2012 2:19 AM
To: Manoj Agarwal
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Problem while restoring a database from SQL_ASCII to
UTF-8

On 06/06/2012 08:30 PM, Manoj Agarwal wrote:
> Hi,
>
> The encoding that is used by the clients that supplied data to the
> database is ISO-8859-1.

I meant to ask in my previous post:

1) What are the special characters causing the problem?

2) What is the data type for the fields holding these characters?

>
> Kind Regards,
> Manoj Agarwal

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Watson 2012-06-08 12:04:21 Re: Postgres 9.2 beta2 one-click installer on windows
Previous Message Craig Ringer 2012-06-08 06:08:59 Re: Procedural Languages