Re: BUG #6480: NLS text width problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sergey Burladyan <eshkinkot(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6480: NLS text width problem
Date: 2012-03-07 00:49:28
Message-ID: 23924.1331081368@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Sergey Burladyan <eshkinkot(at)gmail(dot)com> writes:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> Can you prepare a patch?

> Surely, I was sent this patch to pgsql-hackers and added to the commitfest-next to
> be sure I'll never lost it https://commitfest.postgresql.org/action/patch_view?id=816

Hmm, this patch makes it obvious that the current incarnation of
pg_wcswidth has never worked. Good thing it's been unused for the same
length of time :-(

> Unfortunately, I was sent it with content-disposition: inline by mistake, as
> result, web interface divided it by two independent parts. Also this patch for 9.1

I'm a bit nervous about the idea of back-patching this, as if there is
anything wrong with it it will break code that works perfectly fine for
most people. Possibly more to the point, it is making assumptions about
the behavior of printf with %*s that I think are unportable. Even
granted that libc is glibc, isn't this pretty much guaranteed to fail
if glibc's idea of the encoding is different from pset.encoding?

I think it'd be better to avoid depending on %*s for the data string
and instead use it (with appropriate adjustment of the calculation)
for the space-separator part of the format. Since that's a constant
empty string, there shouldn't be any possibility of libc doing something
other than what we intend.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alex Hunsaker 2012-03-07 04:08:25 Re: BUG #6511: calling spi_exec_query from non-main package, results in: couldn't fetch $_TD
Previous Message tatypr18 2012-03-07 00:41:48 BUG #6522: PostgreSQL does not start