Re: psql linestyle unicode and client encoding

From: Roger Leigh <rleigh(at)codelibre(dot)net>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: peter_e(at)gmx(dot)net, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql linestyle unicode and client encoding
Date: 2011-04-07 23:24:44
Message-ID: 20110407232444.GC1883@codelibre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 07, 2011 at 02:49:29PM -0500, Kevin Grittner wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>
> > Wouldn't it be better if there were a setting in psql that set the
> > linestyle to unicode only if the client encoding was actually
> > UTF8?
>
> Is UTF8 the only client encoding in which we currently support the
> Unicode character set?

Yes. When I wrote the patch, I did the linestyle abstraction as a
simple set of strings; we therefore store the line drawing characters
as "raw" UTF-8 octets rather than UCS codepoints, stored as regular
char* strings.

UCS codepoints would be simpler, and would allow transparent recoding
to the user's locale codeset when doing e.g. wprintf / fputwc, which
might make it simpler to support UTF-16 and other non-UTF-8 UCS
encodings. For systems with libcs like GNU libc, where all locales are
implemented in terms of USC, it will also allow transparent recoding and/
or transliteration in non-Unicode locales as well. The downside is that
it assumes that the system has functional wide character support, while
the current implementation requires no special support at all. I don't
know if this would be a big issue or not.

It should also be possible to use VT100 line drawing characters for most
common terminal emulators (xterm and compatible), which would give line
drawing characters independent of locale. But this is terminal-
dependent.

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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-04-08 00:14:18 Re: pg_upgrade bug found!
Previous Message Andrew Dunstan 2011-04-07 22:58:57 building on WIndows 7