Re: psql weird behaviour with charset encodings

From: hernan gonzalez <hgonzalez(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: psql weird behaviour with charset encodings
Date: 2010-05-07 22:01:56
Message-ID: t2m48692c2d1005071501z5bcab4d5q3d7cf79f23ba568b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

It's surely not a xterm problem, I see the characters ok with just the
\x formatting. I can check also the output redirecting to a file.

My original client_encoding seems to be LATIN9 in both cases,
accorging to the \set ouput.

If I change it (for the root user) to UTF8 with " SET CLIENT_ENCODING
TO 'UTF8'; " the conversion from LATIN9 to UTF8 indeed takes place
(and I see the characters ok, by switching my terminal to UTF8).

(BTW: I understood from the docs that " \set ENCODING 'UTF8'; " is
equivalent but this does nothing in my case)

But I actually dont want that. I want psql to not try any charset
conversion, just give me the raw text as is stored in the db. He seems
to do this when \x is set. But it seems that he need to compute lenght
of the strings and for this he needs to use the string routines from
his own locale.

I'm uncertain yet if this is the expected behaviour.

> What's client_encoding set to in the two cases?  If it's not utf8,
> does changing it to that improve matters?  Alternatively, see what
> xterm (or whatever terminal window you're using) thinks the encoding
> is, and change it to match psql's client_encoding.
>
>                        regards, tom lane
>

--
Hernán J. González
http://hjg.com.ar/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-05-07 22:12:55 Re: psql weird behaviour with charset encodings
Previous Message Tom Lane 2010-05-07 21:43:02 Re: psql weird behaviour with charset encodings

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-05-07 22:12:55 Re: psql weird behaviour with charset encodings
Previous Message Tom Lane 2010-05-07 21:43:02 Re: psql weird behaviour with charset encodings