Mailing List Archive

Postgres: change client encoding
Hi,

the default encoding for postgres changed with version 7.3 to unicode.
When running 'createdb' the encoding can be changed, but I think it's a
good idea to keep all data unicode encoded (actually UTF-8 I think).

I added one line to dbpgsql.c to let postgres do the conversion:

--- dbpgsql.c.orig 2004-01-07 16:00:16.000000000 +0100
+++ dbpgsql.c 2004-01-19 18:12:19.000000000 +0100
@@ -82,6 +82,9 @@
return -1;
}

+ /* switch client encoding to latin1 (default is unicode since 7.3) */
+ db_query("SET NAMES 'Latin1'");
+
return 0;
}

Is there a better/cleaner solution? If not is it possible to add user
defined SQL commands to the config file that are executed after opening
the db connection?


If dbmail adds non UTF-8 characters to a unicode db postgres says:
Jan 19 06:32:56 server postgres[23203]: [3] ERROR: Invalid UNICODE
character sequence found (0xc05e)
Jan 19 06:32:56 server dbmail/smtp[23201]: insert_messages(): error
inserting msgblock


--
MfG Thomas Mueller - http://www.tmueller.com for pgp key (95702B3B)