Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id EE8B4171224F for ; Tue, 6 Mar 2012 20:49:44 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S554Z-0006kq-BK for pgsql-bugs@postgresql.org; Wed, 07 Mar 2012 00:49:44 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q270nSM2023925; Tue, 6 Mar 2012 19:49:28 -0500 (EST) To: Sergey Burladyan cc: Peter Eisentraut , pgsql-bugs@postgresql.org Subject: Re: BUG #6480: NLS text width problem In-reply-to: <87hay1iksj.fsf@home.progtech.ru> References: <87obsq4sus.fsf@home.progtech.ru> <1330714739.11007.4.camel@vanquo.pezone.net> <87hay1iksj.fsf@home.progtech.ru> Comments: In-reply-to Sergey Burladyan message dated "Tue, 06 Mar 2012 23:36:28 +0400" Date: Tue, 06 Mar 2012 19:49:28 -0500 Message-ID: <23924.1331081368@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/45 X-Sequence-Number: 32606 Sergey Burladyan writes: > Peter Eisentraut 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