Re: create a database with encoding LATIN1

From: Grzegorz Szpetkowski <gszpetkowski(at)gmail(dot)com>
To: Sébastien D'Errico <sebastien(at)hollox(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: create a database with encoding LATIN1
Date: 2011-05-03 14:37:14
Message-ID: BANLkTi=fPu=dyWyHdYb_OBDwKfA1iP8gig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

To use 'LATIN1 encoding you need compatible locale. You can specify it
at initdb stage as for example:

>initdb --locale en_CA.ISO-8859-1 -E LATIN1 -d D:/data # -E LATIN1 is redundant in such case

Futhermore since PostgreSQL 8.4 you can specify LC_COLLATE and
LC_CTYPE with CREATE DATABASE command (and createdb wrapper), so these
settings are not "frozen" with database cluster.

Regards,
Grzegorz Szpetkowski

2011/5/3 Sébastien D'Errico <sebastien(at)hollox(dot)net>:
> Hello everyone!
>
>
>
> I read several old messages about encoding. I consult the documentation
> about initdb and the light bulb still does not “click” over my head.
>
>
>
> I installed Postgres 8.4 on Windows 2008.
>
>
>
> I am trying to create a database with encoding LATIN1. This is the result
> when I list all database:
>
>
>
> [CONSOLE]
>
>
>
>>psql -Upostgres –l
>
>
>
>    Name    |    Owner    | Encoding  |      Collation      |
> Ctype        |    Access privileges
>
> -----------+-------------+-----------+---------------------+---------------------+--------------------------
>
> postgres  | postgres    | UTF8      | English_Canada.1252 |
> English_Canada.1252 |
>
> sderrico  | _postgresql | SQL_ASCII | English_Canada.1252 |
> English_Canada.1252 |
>
> template0 | postgres    | UTF8      | English_Canada.1252 |
> English_Canada.1252 | =c/postgres : postgres=CTc/postgres
>
> template1 | postgres    | UTF8      | English_Canada.1252 |
> English_Canada.1252 | postgres=CTc/postgres : _postgresql=CTc/postgres
>
> test1     | postgres    | UTF8      | English_Canada.1252 |
> English_Canada.1252 |
>
>
>
> [/CONSOLE]
>
>
>
> This is the error message that I got when I tried to create the database:
>
>
>
> [CONSOLE]
>
>
>
>>create database test2 ENCODING='LATIN1';
>
>
>
> ERROR:  encoding LATIN1 does not match locale English_Canada.1252
>
> DETAIL:  The chosen LC_CTYPE setting requires encoding WIN1252.
>
>
>
> [/CONSOLE]
>
>
>
> So I tried to change the encoding:
>
>
>
> [CONSOLE]
>
>
>
>>initdb -E LATIN1 -d D:/data
>
>
>
> initdb: encoding mismatch
>
> The encoding you selected (LATIN1) and the encoding that the selected locale
> uses (WIN1252) do not match.  This would lead to misbehavior in various
> character string processing functions.Rerun initdb and either do not specify
> an encoding explicitly, or choose a matching combination.
>
>
>
> [/CONSOLE]
>
>
>
> I installed/uninstalled four time postgresql to change the parameter “local”
> to: POSIX, UTF8, Canada English (default), Canada French
>
>
>
> I think that I need WIN1251 but I cannot figure out how to match the value
> of the “combobox” to those values:
>
> http://www.postgresql.org/docs/8.4/static/multibyte.html
>
>
>
> Can someone help point me out how to switch the local encoding?
>
>
>
> Right now, all database are empty, we can uninstall/install postgresql. The
> specification is “LATIN1” for later use.
>
>
>
> Thank YOU VERY MUCH!
>
> Sébastien
>
>
>
> Sébastien D’Errico
>
> IT Development Consultant
>
> Mobile : (438) 882-8687
>
> Email : sebastien(at)hollox(dot)net
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Didier Gasser-Morlay 2011-05-03 14:51:43 create a database with encoding LATIN1
Previous Message Simon Riggs 2011-05-03 14:33:34 Re: Can we Flush the Postgres Shared Memory ?