Обсуждение: psql linestyle unicode and client encoding

Поиск
Список
Период
Сортировка

psql linestyle unicode and client encoding

От
Peter Eisentraut
Дата:
Random thought: 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?  This might become more relevant as we set the client
encoding automatically in psql in 9.1.  Then a setting of, say,
"unicode-auto" would do the right thing in all cases.




Re: psql linestyle unicode and client encoding

От
"Kevin Grittner"
Дата:
Peter Eisentraut <peter_e@gmx.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?
-Kevin


Re: psql linestyle unicode and client encoding

От
Roger Leigh
Дата:
On Thu, Apr 07, 2011 at 02:49:29PM -0500, Kevin Grittner wrote:
> Peter Eisentraut <peter_e@gmx.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.