diff options
Diffstat (limited to 'django/newforms/util.py')
| -rw-r--r-- | django/newforms/util.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/newforms/util.py b/django/newforms/util.py index 2fec9e4e2e..51a8efdde2 100644 --- a/django/newforms/util.py +++ b/django/newforms/util.py @@ -7,7 +7,10 @@ flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs def smart_unicode(s): if not isinstance(s, basestring): - s = unicode(str(s)) + if hasattr(s, '__unicode__'): + s = unicode(s) + else: + s = unicode(str(s), settings.DEFAULT_CHARSET) elif not isinstance(s, unicode): s = unicode(s, settings.DEFAULT_CHARSET) return s |
