Re: language code incompatibility in Windows

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: language code incompatibility in Windows
Дата
Msg-id 20161011064218.GA1041260@tornado.leadboat.com
обсуждение исходный текст
Ответ на language code incompatibility in Windows  (阎兆珣 <yanzhaoxun@greendh.com>)
Список pgsql-bugs
On Wed, Sep 07, 2016 at 11:02:28AM +0800, 阎兆珣 wrote:
>    For PG 9.1 ~ 9.5 in Windows 7 32bit
>
>    psql can not recognize Chinese database name while pgAdmin III can.
>
>    psql_Chinese

This is probably a symptom of a character encoding mismatch.  You ran psql in
a console window, so psql received your input encoded with the console input
code page.  Based on [1], pgAdmin III probably used UTF8 encoding in your
environment.  The default console input code page depends on locale settings,
but it is never UTF8.

This C program demonstrates psql's ability to connect to a Chinese-named
database on Windows (tested with binaries from [2]):

/* initdb --locale=C --encoding=UTF8 */
#include <stdlib.h>
int main(int argc, char **argv)
{
    system("createdb \xe5\xa3\xa4");
    system("psql -c "
       "\"select current_database(), octet_length(current_database())\" "
       "\xe5\xa3\xa4");
    return 0;
}

I recommend against non-ASCII characters in database names.  PostgreSQL
performs encoding conversion, according to the client_encoding setting, on
most of the database session.  It does not convert database names; it largely
treats them as byte sequences, not text.  Non-ASCII database names work fine
if every client program uses the same encoding; otherwise, they create the
trouble you're experiencing.  Avoid non-ASCII role names, too, for the same
reasons.

[1] https://www.postgresql.org/message-id/CA%2BOCxozjhM5wAj84vjRNWX5TLEYEMYeh37U%3DibJt22m5nqtJmA@mail.gmail.com
[2] http://get.enterprisedb.com/postgresql/postgresql-9.5.4-2-windows-x64-binaries.zip

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tilo Sloboda
Дата:
Сообщение: Re: BUG #14362: Postgres macaddr does not support EUI-64 8-byte MAC addresses
Следующее
От: Grigory Smolkin
Дата:
Сообщение: parallel plan in insert query