Nitin Gore
Nitin Gore

Reputation: 1

How to create the Database in Postgreql with ISO 8859-1 Character set?

I am trying to create the database named "MUSIC" in PostgreSQL with ISO 8859-1 Character Set. I am getting the below error:

testdb=# CREATE DATABASE MUSIC WITH ENCODING 'ISO 8859-1';

ERROR:  encoding "LATIN1" does not match locale "English_India.1252"
DETAIL: The chosen LC_CTYPE setting requires encoding "WIN1252".

Upvotes: 0

Views: 2109

Answers (2)

Marco Flores
Marco Flores

Reputation: 21

Encoding "WIN1252", example:

postgres=# CREATE DATABASE database_name WITH TABLESPACE tablespace_name TEMPLATE = template0 OWNER = database_user ENCODING 'WIN1252' LC_CTYPE = 'Portuguese_Brazil.1252' LC_COLLATE = 'Portuguese_Brazil.1252';
CREATE DATABASE
postgres=#
postgres=# \l

                                             

List of databases

     Name      |     Owner     | Encoding |        Collate         | Ctype |  Access privileges
 database_name | database_user | WIN1252  | Portuguese_Brazil.1252 | Portuguese_Brazil.1252 |

Upvotes: 2

Laurenz Albe
Laurenz Albe

Reputation: 248125

If you really want a single-byte encoding, use WIN1252. It is a strict superset of ISO 8859-1 and is available on Windows (in the typical Microsoft style of embrace, extend and extinguish).

But there is no good reason to use an encoding other than UTF8, and that is what I recommend you to use.

Upvotes: 4

Related Questions