From 080cebaf69891f4b2b575a1e9fd7ceb4d2170623 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 27 Apr 2007 08:29:08 +0000 Subject: [PATCH] unicode: Changed StrAndUnicode class to be consistent with everything else as to the encoding of bytestrings. git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5101 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/encoding.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/django/utils/encoding.py b/django/utils/encoding.py index eb6b63660e..402b946e65 100644 --- a/django/utils/encoding.py +++ b/django/utils/encoding.py @@ -47,13 +47,10 @@ def smart_str(s, encoding='utf-8', strings_only=False): class StrAndUnicode(object): """ - A class whose __str__ returns its __unicode__ as a bytestring - according to settings.DEFAULT_CHARSET. + A class whose __str__ returns its __unicode__ as a UTF-8 bytestring. Useful as a mix-in. """ def __str__(self): - # XXX: (Malcolm) Correct encoding? Be variable and use UTF-8 as - # default? - return self.__unicode__().encode(settings.DEFAULT_CHARSET) + return self.__unicode__().encode('utf-8')