Thread: Latin2 and UTF-8 encoding.

Latin2 and UTF-8 encoding.

From
"kpeter@oszk.hu"
Date:
Dear Sur!

My name is Peter Kovacs and I work at the National Szechenyi Library in
Hunagry.
The reason why im writing this letter is the follow:
We are using Potgresql to store our data. We have UTF-8, LATIN1 and
LATIN2 encoded databases.
I haven't got any problem with database encoding before, but when I
tried ro restore our database dumps to a postgresql 8.3.3 server it faild.
If I tried to create a database with NON-UTF-8 character encoding I got
the following error:

*SQL error:*

ERROR:  encoding LATIN2 does not match server's locale en_AU.UTF-8
DETAIL:  The server's LC_CTYPE setting requires encoding UTF8.

*In statement:*
CREATE DATABASE "probadb" WITH ENCODING='LATIN2'


The problem is that we need both UTF-8, LATIN1 and LATIN2 characters.

My question is: How could I create a database with NON-UTF-8 encoding.

Regards!

Peter Kovacs

Re: Latin2 and UTF-8 encoding.

From
"Heikki Linnakangas"
Date:
kpeter@oszk.hu wrote:
> The problem is that we need both UTF-8, LATIN1 and LATIN2 characters.
>
> My question is: How could I create a database with NON-UTF-8 encoding.

Just use UTF-8. UTF-8 can represent all characters that are present in
LATIN1 and LATIN2.

You can still use LATIN1 or LATIN2 as client_encoding if you need to,
even if the server uses UTF-8.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Re: Latin2 and UTF-8 encoding.

From
tomas@tuxteam.de
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Aug 25, 2008 at 12:29:14PM +0200, kpeter@oszk.hu wrote:
> Dear Sur!
>
> My name is Peter Kovacs and I work at the National Szechenyi Library in
> Hunagry.
> The reason why im writing this letter is the follow:
> We are using Potgresql to store our data. We have UTF-8, LATIN1 and LATIN2
> encoded databases.
> I haven't got any problem with database encoding before, but when I tried
> ro restore our database dumps to a postgresql 8.3.3 server it faild.
> If I tried to create a database with NON-UTF-8 character encoding I got the
> following error:
>
> *SQL error:*
>
> ERROR:  encoding LATIN2 does not match server's locale en_AU.UTF-8
> DETAIL:  The server's LC_CTYPE setting requires encoding UTF8.

You should set the locale to the right value on the server start script.
Make sure your platform supports it.

> *In statement:*
> CREATE DATABASE "probadb" WITH ENCODING='LATIN2'
>
>
> The problem is that we need both UTF-8, LATIN1 and LATIN2 characters.
>
> My question is: How could I create a database with NON-UTF-8 encoding.

I don't quite understand. You cannot have a database which is UTF-8,
LATIN1 and LATIN2 at the same time.

By the way, this is the wrong list for this question. This list is
dedicated to bugs of PostgreSQL and this is not it.

Feel free to mail pgsql-novice@postgresql.org (or mail me privately if
you think I can be of any help).

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIssHSBcgs9XrR2kYRAiHJAJ49drH5Br/Kak2MoRhPUf1HXVuHoQCdFbPO
dRs9T99wV+aKGqsjJDT1bIQ=
=OKLd
-----END PGP SIGNATURE-----

Re: Latin2 and UTF-8 encoding.

From
Peter Eisentraut
Date:
On Monday 25 August 2008 13:29:14 kpeter@oszk.hu wrote:
> ERROR:  encoding LATIN2 does not match server's locale en_AU.UTF-8
> DETAIL:  The server's LC_CTYPE setting requires encoding UTF8.

In 8.3, it no longer works to create databases of different or incompatible
encodings.  You need to pick one encoding for all databases and you need to
pick a locale setting to matches that.

If you work for a Hungarian library, you probably don't want a locale setting
en_AU... either.  Instead, you probably want hu_HU.utf8.

> The problem is that we need both UTF-8, LATIN1 and LATIN2 characters.

UTF-8 can store all characters that LATIN1 and LATIN2 can encode.  You just
need to configure your client encoding correctly and the data sent by the
client will automatically be converted to UTF-8 and back.