From 7b5d80d36d47bcbd04038844902b5786e656f6f5 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo <daniele.varrazzo@gmail.com> Date: Tue, 14 Dec 2010 03:32:30 +0000 Subject: [PATCH] Added a few missing encodings. EUC_CN, EUC_JIS_2004, ISO885910, ISO885916, LATIN10, SHIFT_JIS_2004. --- ChangeLog | 3 +++ NEWS-2.3 | 8 ++++++++ psycopg/psycopgmodule.c | 36 +++++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11081e5e..06d72523 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * lib/extensions.py: Improved mapping from PG to Py encodings. + * psycopg/psycopgmodule.c: Added a few missing encodings: EUC_CN, + EUC_JIS_2004, ISO885910, ISO885916, LATIN10, SHIFT_JIS_2004. + 2010-12-04 Daniele Varrazzo <daniele.varrazzo@gmail.com> * setup.py: bumped to version 2.3.1.dev0 diff --git a/NEWS-2.3 b/NEWS-2.3 index d8208d9b..312d80e9 100644 --- a/NEWS-2.3 +++ b/NEWS-2.3 @@ -1,3 +1,11 @@ +What's new in psycopg 2.3.2 +--------------------------- + + - Improved PostgreSQL-Python encodings mapping. Added a few + missing encodings: EUC_CN, EUC_JIS_2004, ISO885910, ISO885916, + LATIN10, SHIFT_JIS_2004. + + What's new in psycopg 2.3.1 --------------------------- diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index f4f57417..9b3f54cd 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -328,21 +328,25 @@ static encodingPair encodings[] = { {"ABC", "cp1258"}, {"ALT", "cp866"}, {"BIG5", "big5"}, + {"EUC_CN", "euccn"}, + {"EUC_JIS_2004", "euc_jis_2004"}, {"EUC_JP", "euc_jp"}, {"EUC_KR", "euc_kr"}, {"GB18030", "gb18030"}, {"GBK", "gbk"}, - {"ISO88591", "iso8859_1"}, - {"ISO885913", "iso8859_13"}, - {"ISO885914", "iso8859_14"}, - {"ISO885915", "iso8859_15"}, - {"ISO88592", "iso8859_2"}, - {"ISO88593", "iso8859_3"}, - {"ISO88595", "iso8859_5"}, - {"ISO88596", "iso8859_6"}, - {"ISO88597", "iso8859_7"}, - {"ISO88598", "iso8859_8"}, - {"ISO88599", "iso8859_9"}, + {"ISO_8859_1", "iso8859_1"}, + {"ISO_8859_2", "iso8859_2"}, + {"ISO_8859_3", "iso8859_3"}, + {"ISO_8859_5", "iso8859_5"}, + {"ISO_8859_6", "iso8859_6"}, + {"ISO_8859_7", "iso8859_7"}, + {"ISO_8859_8", "iso8859_8"}, + {"ISO_8859_9", "iso8859_9"}, + {"ISO_8859_10", "iso8859_10"}, + {"ISO_8859_13", "iso8859_13"}, + {"ISO_8859_14", "iso8859_14"}, + {"ISO_8859_15", "iso8859_15"}, + {"ISO_8859_16", "iso8859_16"}, {"JOHAB", "johab"}, {"KOI8", "koi8_r"}, {"KOI8R", "koi8_r"}, @@ -356,10 +360,15 @@ static encodingPair encodings[] = { {"LATIN7", "iso8859_13"}, {"LATIN8", "iso8859_14"}, {"LATIN9", "iso8859_15"}, + {"LATIN10", "iso8859_16"}, {"Mskanji", "cp932"}, {"ShiftJIS", "cp932"}, + {"SHIFT_JIS_2004", "shift_jis_2004"}, {"SJIS", "cp932"}, - {"SQL_ASCII", "ascii"}, + {"SQL_ASCII", "ascii"}, /* XXX this is wrong: SQL_ASCII means "no + * encoding" we should fix the unicode + * typecaster to return a str or bytes in Py3 + */ {"TCVN", "cp1258"}, {"TCVN5712", "cp1258"}, {"UHC", "cp949"}, @@ -388,10 +397,7 @@ static encodingPair encodings[] = { {"Windows950", "cp950"}, /* those are missing from Python: */ -/* {"EUC_CN", "?"}, */ /* {"EUC_TW", "?"}, */ -/* {"LATIN10", "?"}, */ -/* {"ISO885916", "?"}, */ /* {"MULE_INTERNAL", "?"}, */ {NULL, NULL} };