Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal

From: Reinhard Max <max(at)suse(dot)de>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal
Date: 2001-09-06 10:47:38
Message-ID: Pine.LNX.4.33.0109061227010.6736-100000@wotan.suse.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Thu, 6 Sep 2001, Peter Eisentraut wrote:

> Reinhard Max writes:
>
> > So basically there are two possibilities:
> >
> > a) Patch pl/tcl and PgTcl to do the code conversion, but do it right
> > by using the Database's encoding instead of Tcl's system encoding.
> >
> > b) Require databases to be in UNICODE if they are to be accessed
> > from Tcl >= 8.1 so that the strings that come out of the database
> > are already UTF-8.
>
> Could you summarize how that affects the proposed patch? (The
> patch is already in, but I'm still not sure if it's not just an
> arbitrary workaround.)

for a) Tcl_ExternalToUtfDString and Tcl_UtfToExternalDString need to
be called with the first Argument (encoding) being a Tcl_Encoding
struct that is initialized to represent the encoding that is used in
the database.

for b) the proposed patch would become unneeded. Instead of that, a
warning could be issued, if one tried to access a non UTF-8 database
from Tcl.

For a third proposal which is IMHO the cleanest one so far, please
have a look at the mail, I've sent to Bruce and psql-bugs earlier
today. In short: PostgreSQL should be compiled with --enable-multibyte
and --enable-unicode-convertion and the Tcl interfaces (PgTcl and
PL/Tcl) should be changed to set their client encoding to UNICODE if
the Tcl version requires UTF-8 strings.

cu
Reinhard

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Vsevolod Lobko 2001-09-06 10:52:43 Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal
Previous Message Vsevolod Lobko 2001-09-06 10:33:53 Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal