Re: Unicode UTF-8 table formatting for psql text output - Mailing list pgsql-hackers

From Roger Leigh
Subject Re: Unicode UTF-8 table formatting for psql text output
Date
Msg-id 20091024172324.GB17870@codelibre.net
Whole thread Raw
In response to Re: Unicode UTF-8 table formatting for psql text output  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Unicode UTF-8 table formatting for psql text output  (Roger Leigh <rleigh@codelibre.net>)
List pgsql-hackers
On Fri, Oct 16, 2009 at 01:38:15PM +0300, Peter Eisentraut wrote:
> I like the new Unicode tables, but the marking of continuation lines
> looks pretty horrible:
>
>                              List of databases
>      Name      │ Owner │ Encoding │ Collation │ Ctype │ Access
> privileges
> ───────────────┼───────┼──────────┼───────────┼───────┼───────────────────
>  pl_regression │ peter │ LATIN2   │ cs_CZ     │ cs_CZ │
>  postgres      │ peter │ LATIN2   │ cs_CZ     │ cs_CZ │
>  template0     │ peter │ LATIN2   │ cs_CZ     │ cs_CZ │ =c/peter
>                ╷       ╷          ╷           ╷       ╎ peter=CTc/peter
>  template1     │ peter │ LATIN2   │ cs_CZ     │ cs_CZ │ =c/peter
>                ╷       ╷          ╷           ╷       ╎ peter=CTc/peter
> (4 rows)
>
> This looks more like a rendering mistake than something sensible, and
> also it doesn't actually help the viewer to tell what lines are
> continued, which was the original purpose.

I've worked on a solution to this, and the preliminary patch for this
is attached.  Note there are additional comments in the patch text.

This patch does break backward compatibility with older psql versions,
by using symbols in the column border to mark newlines and wrapped
lines rather than putting ':' and ';' and ' ' symbols in the vertical
table lines.  This makes things somewhat more consistent and readable
but at the expense of not perfectly preserving output.  The ASCII
rules are a little more compatible than the Unicode rules, but both
do break things a little.  If the data lines do not contain either
newlines or wrapped text, then the output will remain unchanged.

Any feedback would be appreciated.


Regards,
Roger

--
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Parsing config files in a directory
Next
From: Greg Smith
Date:
Subject: Re: Parsing config files in a directory