From 5642a68adb1e923c122cc07383658ba03e8990ad Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Fri, 19 Jan 2007 14:38:01 +0000 Subject: [PATCH] Encodings from Karsten. --- ChangeLog | 6 ++++ NEWS | 20 +++++++++++++ psycopg/psycopgmodule.c | 64 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1d684f4..52d3a622 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-20 Federico Di Gregorio + + * Release 2.0.6b1. + + * Added encodings patch from Karsten Hilbert. + 2007-01-19 Federico Di Gregorio * psycopg/adapt_list.c: added support for None. And this closes diff --git a/NEWS b/NEWS index 2268d4a2..6f3c6a15 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,23 @@ +What's new in psycopg 2.0.6 +--------------------------- + +* Full support for PostgreSQL 8.2, including NULLs in arrays. + +* Support for almost all PostgreSQL encodings. + +* Better management of times and dates both from Python and in Zope. + +* We now have a full list of PostgreSQL error codes available by + importing the psycopg2.errorcodes module. + +* Fixed some small buglets and build glitches: + - removed double mutex destroy + - removed all non-constant initializers + - fixed PyObject_HEAD declarations to avoid memory corruption + on 64 bit architectures + - fixed several Python API calls to work on 64 bit architectures + - applied compatibility macros from PEP 353 + What's new in psycopg 2.0.5.1 ­---------------------------- diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index 123e3e21..a177639b 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -304,14 +304,68 @@ static encodingPair encodings[] = { {"LATIN6", "iso8859_10"}, {"LATIN7", "iso8859_13"}, {"LATIN8", "iso8859_14"}, - {"LATIN9", "iso8859_15"}, - {"UNICODE", "utf_8"}, + {"LATIN9", "iso8859_15"}, + {"ISO88591", "iso8859_1"}, + {"ISO88592", "iso8859_2"}, + {"ISO88593", "iso8859_3"}, + {"ISO88595", "iso8859_5"}, + {"ISO88596", "iso8859_6"}, + {"ISO88597", "iso8859_7"}, + {"ISO885913", "iso8859_13"}, + {"ISO88598", "iso8859_8"}, + {"ISO88599", "iso8859_9"}, + {"ISO885914", "iso8859_14"}, + {"ISO885915", "iso8859_15"}, + {"UNICODE", "utf_8"}, /* Not valid in 8.2, backward compatibility */ {"UTF8", "utf_8"}, - - /* some compatibility stuff */ - {"LATIN-1", "latin_1"}, + {"WIN950", "cp950"}, + {"Windows950", "cp950"}, + {"BIG5", "big5"}, + {"EUC_JP", "euc_jp"}, + {"EUC_KR", "euc_kr"}, + {"GB18030", "gb18030"}, + {"GBK", "gbk"}, + {"WIN936", "gbk"}, + {"Windows936", "gbk"}, + {"JOHAB", "johab"}, + {"KOI8", "koi8_r"}, /* in PG: KOI8 == KOI8R == KOI8-R == KOI8-U + but in Python there is koi8_r AND koi8_u */ + {"KOI8R", "koi8_r"}, + {"SJIS", "cp932"}, + {"Mskanji", "cp932"}, + {"ShiftJIS", "cp932"}, + {"WIN932", "cp932"}, + {"Windows932", "cp932"}, + {"UHC", "cp949"}, + {"WIN949", "cp949"}, + {"Windows949", "cp949"}, + {"WIN866", "cp866"}, + {"ALT", "cp866"}, + {"WIN874", "cp874"}, + {"WIN1250", "cp1250"}, + {"WIN1251", "cp1251"}, + {"WIN", "cp1251"}, + {"WIN1252", "cp1252"}, + {"WIN1253", "cp1253"}, + {"WIN1254", "cp1254"}, + {"WIN1255", "cp1255"}, + {"WIN1256", "cp1256"}, + {"WIN1257", "cp1257"}, + {"WIN1258", "cp1258"}, + {"ABC", "cp1258"}, + {"TCVN", "cp1258"}, + {"TCVN5712", "cp1258"}, + {"VSCII", "cp1258"}, + +/* those are missing from Python: */ +/* {"EUC_CN", "?"}, */ +/* {"EUC_TW", "?"}, */ +/* {"LATIN10", "?"}, */ +/* {"ISO885916", "?"}, */ +/* {"MULE_INTERNAL", "?"}, */ {NULL, NULL} }; + static void psyco_encodings_fill(PyObject *dict) { encodingPair *enc;