Skip site navigation (1) Skip section navigation (2)

Re: libpgtcl doesn't use UTF encoding of TCL

From: Reinhard Max <max(at)suse(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <elf(at)solvo(dot)ru>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: libpgtcl doesn't use UTF encoding of TCL
Date: 2001-09-06 09:43:12
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugspgsql-hackerspgsql-interfaces
Hi Bruce,

On Wed, 5 Sep 2001, Bruce Momjian wrote:

> I have a patch here that handles all the TCL/UTF issues.
> Would you let me know if it is OK?

I think, it isn't really a clean fix. It only works, if your
database's encoding and Tcl's system encoding are identical. If the
database uses a different encoding than Tcl, you still end up with
wrong characters. Also, the configure switch (if needed at all)
should IMHO be a disable switch, because the conversion is mandatory
for Tcl >= 8.1 unless someone really knows that he won't have any
8-Bit characters in his database. So less people would get bitten, if
UTF conversion was enabled by default for Tcl >= 8.1 .

Besides these flaws, I think the patch could be simpler and avoid the
UTF_BEGIN and UTF_END macros if UTF_U2E and UTF_E2U were (maybe
inlined) functions and defined like this (untested):

char* UTF_U2E(CONST char * source)
	static Tcl_DString *destPtr = NULL;

	if (destPtr == NULL) {
		destPtr = (Tcl_DString *) malloc(sizeof(Tcl_DString));
	} else {
	return Tcl_UtfToExternalDString(NULL, source, -1, destPtr);

See also the mail, I sent to pgsql-patches last Tuesday on the same

In addition to my suggestion there to require the database to be
UNICODE for Tcl >= 8.1, I just had another Idea how it could be solved

What about making --enable-unicode-conversion mandatory when
PostgreSQL gets compiled with Tcl support and changing PgTcl and
PL/Tcl to set their client encoding to UNICODE at _runtime_ when they
find themselfes running with a Tcl interpreter that needs UTF-8 (i.e.
Tcl >= 8.1)?

Going this way, we could even retain binary compatibility for PgTcl
and PL/Tcl with Tcl versions prior and after Tcl's move to UTF-8.

One Question remains here: Do --enable-multibyte and
--enable-unicode-conversion have any downsides (besides a larger
executable), if they are compiled in, but not used?


In response to

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2001-09-06 10:02:55
Subject: Re: Log rotation?
Previous:From: Denis PerchineDate: 2001-09-06 09:11:05
Subject: Re: Problems starting up postgres

pgsql-bugs by date

Next:From: Wjatscheslaw W├ĄchterDate: 2001-09-06 09:50:48
Subject: upper() don't work with field-alias in the order by part of select statement.
Previous:From: Oliver SmithDate: 2001-09-06 06:05:31
Subject: Unexpected behaviour (7.13, FreeBSD)

pgsql-interfaces by date

Next:From: Robert EwaldDate: 2001-09-11 11:43:13
Subject: PostgreSQL ODBC Driver and MS Access OLE field problem
Previous:From: Bruce MomjianDate: 2001-09-05 16:52:37
Subject: Re: libpgtcl doesn't use UTF encoding of TCL

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group