diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-09-10 14:49:12 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-09-10 14:49:12 +0000 |
commit | 9e46767161fdbb3904bfbb4c786a7addfd1bad91 (patch) | |
tree | e640becb48f24eee3e25efa43b7cffdea443cedb /src | |
parent | 0ee85f853f8b5b61f70e0ea7420266595b4831d9 (diff) | |
download | postgresql-9e46767161fdbb3904bfbb4c786a7addfd1bad91.tar.gz postgresql-9e46767161fdbb3904bfbb4c786a7addfd1bad91.zip |
The attached patch should be sufficient to fix libpgtcl. It requires
PostgreSQL to support unicode-conversion, but retains binary
compatibility among Tcl versions.
However, it neither checks at compile time not at runtime, if support
for unicode-conversion does really exist and it doesn't prevent the
user from changing the client encoding after initialization. I think
there should be warnings about this somewhere in the documentation.
Reinhard Max
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/libpgtcl/pgtcl.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/interfaces/libpgtcl/pgtcl.c b/src/interfaces/libpgtcl/pgtcl.c index 6da179ced57..64a32464873 100644 --- a/src/interfaces/libpgtcl/pgtcl.c +++ b/src/interfaces/libpgtcl/pgtcl.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.21 2001/03/22 04:01:23 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.22 2001/09/10 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ int Pgtcl_Init(Tcl_Interp *interp) { + double tclversion; /* * finish off the ChannelType struct. Much easier to do it here then @@ -39,6 +40,13 @@ Pgtcl_Init(Tcl_Interp *interp) Pg_ConnType.getFileProc = PgGetFileProc; #endif + /* + * Tcl versions >= 8.1 use UTF-8 for their internal string representation. + * Therefore PGCLIENTENCODING must be set to UNICODE for these versions. + */ + Tcl_GetDouble(interp, Tcl_GetVar(interp, "tcl_version", TCL_GLOBAL_ONLY), &tclversion); + if (tclversion >= 8.1) setenv("PGCLIENTENCODING", "UNICODE", 1); + /* register all pgtcl commands */ Tcl_CreateCommand(interp, "pg_conndefaults", |