Обсуждение: ProblemWithCharsOSX

Поиск
Список
Период
Сортировка

ProblemWithCharsOSX

От
Angel Zúñiga
Дата:
Hi there,

I'm a PostgreSQL user in the linux world but at the office there is a Mac computer and I have a problem with postgres in it.

The problem is when I use characters with tildes in spanish like in the follow word "países".
The next is ilustrates my problem:

test=# SHOW SERVER_ENCODING;
 server_encoding
-----------------
 UTF8
(1 row)

test=# SELECT pg_client_encoding();
 pg_client_encoding
--------------------
 UTF8
(1 row)

test=# CREATE TABLE países (nombre VARCHAR(10));
CREATE TABLE
test=# \d
        List of relations
 Schema | Name  | Type  | Owner 
--------+-------+-------+--------
 public | pases | table | dragon
(1 row)

The table name is created without the "í" character but if I enclose the string between quotes postgres works fine.
test=# CREATE TABLE "países" (nombre VARCHAR(10));
CREATE TABLE
test=# \d
        List of relations
 Schema |  Name  | Type  | Owner 
--------+--------+-------+--------
 public | países | table | dragon
 public | pases  | table | dragon
(2 rows)
test=# \l
                                     List of databases
      Name       |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges  
-----------------+----------+----------+-------------+-------------+-----------------------
 template0       | postgres | UTF8     | es_MX.UTF-8 | es_MX.UTF-8 | =c/postgres          +
                 |          |          |             |             | postgres=CTc/postgres
 template1       | postgres | UTF8     | es_MX.UTF-8 | es_MX.UTF-8 | postgres=CTc/postgres+
                 |          |          |             |             | =c/postgres
 test            | dragon   | UTF8     | es_MX.UTF-8 | es_MX.UTF-8 |


In the linux box all works fine, so I think the problem is something particular to Mac,
The Mac OS X version is 10.7.4.
Darwin Users-iMac.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64

and the postgres version is 9.0.8.

Can Anybody help me with my problem?

Thanks in advance,
Angel  



 

Re: ProblemWithCharsOSX

От
Tom Lane
Дата:
Angel Zúñiga <junior@ciencias.unam.mx> writes:
> I'm a PostgreSQL user in the linux world but at the office there is a Mac
> computer and I have a problem with postgres in it.

> The problem is when I use characters with tildes in spanish like in the
> follow word "pa�ses".
> The next is ilustrates my problem:

> test=# SHOW SERVER_ENCODING;
>  server_encoding
> -----------------
>  UTF8
> (1 row)

> test=# SELECT pg_client_encoding();
>  pg_client_encoding
> --------------------
>  UTF8
> (1 row)

> test=# CREATE TABLE pa�ses (nombre VARCHAR(10));
> CREATE TABLE
> test=# \d
>         List of relations
>  Schema | Name  | Type  | Owner
> --------+-------+-------+--------
>  public | pases | table | dragon
> (1 row)

FWIW, I cannot reproduce that as stated on my own Mac.  I suspect though
that the problem is not with Postgres per se but with your terminal
window.  If you're using Terminal, check the encoding setting in
Preferences ... Settings, and also look at Preferences ... Encodings.
You'll probably have trouble unless Terminal is using the same encoding
that psql thinks the client_encoding is.
        regards, tom lane