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 20090827104801.GA5973@codelibre.net
Whole thread Raw
In response to Re: Unicode UTF-8 table formatting for psql text output  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Unicode UTF-8 table formatting for psql text output  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On Tue, Aug 25, 2009 at 10:32:50PM -0400, Alvaro Herrera wrote:
> Roger Leigh escribió:
>
> > An updated copy of the patch is attached.
>
> Did you give expanded output a look?  (\x)  I find it a bit weird that
> the first line shows a single-pixel wide line but the subsequent ones
> are thicker.

Yes, it's just due to the fact that the middle lines are using a
thicker line character, while the top and bottom lines are thin.
This can easily be changed to be e.g. all thin.

> BTW I think you should also look at multiline fields,
>
>  a │                                           b
> ━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>  4 │ some text
>    : and some more
>    : and then some
> (1 filas)
>
> And wrapped:
>
> alvherre=# select * from foo;
>  a │                                     b
> ━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>  5 │ En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho
>    ; tiempo que vivía un hidalgo
> (1 fila)

I initially left these exactly the same as for ASCII (the ':' and ';'
usage).  However, it's quite possible to make it use other characters.
We could use the same lines, or two, three or four dashed lines
('╎' and '╏', or ┆' and '┇' or '┊' and '┋').
There are also additional characters such as half-lines
('╶', '╷', '╹' and '╻').  Is this the kind of this you are referring
to?

The wrapping code also appears slightly broken anyway, since
continuation lines don't get '|' printed for subsequent blank columns
on the same line:

# SELECT * FROM testw;a │          b          │ c │ kfduagahkjdfghalksdkfhajsdkl
━━━┿━━━━━━━━━━━━━━━━━━━━━┿━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━1 │ This is a test stri │   │
; ng2 │ sbuild-createchroot │   │  ;  installs build-ess  ; entials so your wor  ; king3 │ sbuild-createchroot │   │  ;
installs build-ess  ; entials so your wor  ; king environment sh  ; ould already be ok.  ;  You will need only  ;  to
adda few more  ; packages in the chr  ; oot, using e.g. 
(3 rows)

(this is unchanged from psql behaviour in CVS.)

I also see in the code that under some circumstances (curr_nl_line), a
'+' is used instead of a space when printing table headers, but I
haven't been able to trigger this yet.  We could also use dashed
horizontal rules here.


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. 

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Build system problem in 8.3.x
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: Build system problem in 8.3.x