Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal - Mailing list pgsql-patches

From Reinhard Max
Subject Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal
Date
Msg-id Pine.LNX.4.33.0109061227010.6736-100000@wotan.suse.de
Whole thread Raw
In response to Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal
List 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


pgsql-patches by date:

Previous
From: Vsevolod Lobko
Date:
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal
Next
From: Vsevolod Lobko
Date:
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal