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, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql weird behaviour with charset encodings
Date: 2010-05-08 17:08:02
Message-ID: w2w48692c2d1005081008v485459f8he87460da7e1beaaf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Wow, you are right, this is bizarre...

And it's not that glibc intends to compute the length in unicode chars,
it actually counts bytes (c plain chars) -as it should- for computing
field widths...
But, for some strange reason, when there is some width calculation involved
it tries so parse the char[] using the locale encoding (when there's no point
in doing it!) and if it fails, it truncates (silently) the printf output.
So it seems more a glib bug to me than an interpretion issue (bytes vs chars).
I posted some details in stackoverflow:
http://stackoverflow.com/questions/2792567/printf-field-width-bytes-or-chars

BTW, I understand that postgresql uses locale semantics in the server code.
But is this really necessary/appropiate in the client (psql) side?
Couldnt we stick
with C locale here?

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hgonzalez 2010-05-08 22:50:51 Re: [GENERAL] psql weird behaviour with charset encodings
Previous Message Karl Denninger 2010-05-08 16:42:54 Query Issue with full-text search

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-05-08 18:48:36 Re: max_standby_delay considered harmful
Previous Message Tom Lane 2010-05-08 16:54:04 Re: possible memory leak with SRFs