Re: Default PostgreSQL server encoding - Change to unicode (utf8)

From: Léa Massiot <lmhelp1(at)orange(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Default PostgreSQL server encoding - Change to unicode (utf8)
Date: 2012-02-27 11:55:43
Message-ID: 1330343743050-5518720.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.
Thank you for your answer.
I used the &lt;raw&gt; and &lt;/raw&gt; tags, this is probably the reason
why you couldn't see the messages...
Thank you for the two links.
I read this (in the second one): "On Windows, however, UTF-8 encoding can be
used with any locale." yet I still have some questions...

On Unix (Debian GNU Linux Squeeze):

=========================================================================================
psql_cmd> \l

----------+----------+----------+-------------+------------
Name | Owner | Encoding | Collation | Ctype
----------+----------+----------+-------------+------------
template1 | postgres | UTF8 | en_us.UTF-8 | en_us.UTF-8

=========================================================================================

On Windows (XP):

=========================================================================================
psql_cmd> \l


----------+----------+----------+----------------------------+---------------------------
Name | Owner | Encoding | Collation | Ctype

----------+----------+----------+----------------------------+---------------------------
template1 | postgres | UTF8 | English_United States.1252 |
English_United States.1252

=========================================================================================

Question 1
Focusing on the "Collation" and "Ctype" columns,
has "English_United States.1252" something to do with "Windows-1252"
("CP-1252")?
"CP-1252" is an 8 bits character encoding (so, it can map codes to 2^8
characters at most).
How compatible is this with an "UTF8" "Encoding"?
For people testing PostgreSQL under Windows, is there any other more
appropriate "Collation" that could be used to set a database collation?
There is no "locale -a" command avaiblable under Windows. Is there any
workaround?

Question 2
Suppose I have a PostgreSQL table which has a VARCHAR column "text".
Suppose I want to insert the string "Li 李" which contains the Chinese
ideograph 李.
How can I do this with an "INSERT INTO" command?
I wish I could do something like:
INSERT INTO t (text) VALUES ('Li U+674E')
or
INSERT INTO t (text) VALUES ('Li \u674E')
How can I do this?

Thanks and best regards.
--
Léa

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Default-PostgreSQL-server-encoding-Change-to-unicode-utf8-tp5505985p5518720.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2012-02-27 12:19:10 Re: Four issues why "old elephants" lack performance: Explanation sought Four issues why "old elephants" lack performance: Explanation sought
Previous Message Stefan Keller 2012-02-27 11:46:01 Re: Four issues why "old elephants" lack performance: Explanation sought Four issues why "old elephants" lack performance: Explanation sought