diff --git a/AUTHORS b/AUTHORS
index f5d274ebc5..486359cc62 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -141,6 +141,7 @@ answer newbie questions, and generally made Django that much better:
Bruce Kroeze
Joseph Kocherhans
konrad@gwu.edu
+ kurtiss@meetro.com
lakin.wecker@gmail.com
Stuart Langridge
Nicola Larosa
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index ef0d06f6a1..a6a2351c6e 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -40,11 +40,21 @@ class UnicodeCursorWrapper(object):
self.cursor = cursor
self.charset = charset
+ def format_params(self, params):
+ if isinstance(params, dict):
+ result = {}
+ charset = self.charset
+ for key, value in params.items():
+ result[smart_str(key, charset)] = smart_str(value, charset)
+ return result
+ else:
+ return tuple([smart_str(p, self.charset, True) for p in params])
+
def execute(self, sql, params=()):
- return self.cursor.execute(smart_str(sql, self.charset), [smart_str(p, self.charset, True) for p in params])
+ return self.cursor.execute(smart_str(sql, self.charset), self.format_params(params))
def executemany(self, sql, param_list):
- new_param_list = [tuple([smart_str(p, self.charset) for p in params]) for params in param_list]
+ new_param_list = [self.format_params(params) for params in param_list]
return self.cursor.executemany(sql, new_param_list)
def __getattr__(self, attr):