Django

Code

Changeset 5101

Show
Ignore:
Timestamp:
04/27/07 03:29:08 (2 years ago)
Author:
mtredinnick
Message:

unicode: Changed StrAndUnicode? class to be consistent with everything else as
to the encoding of bytestrings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/unicode/django/utils/encoding.py

    r4971 r5101  
    4848class StrAndUnicode(object): 
    4949    """ 
    50     A class whose __str__ returns its __unicode__ as a bytestring 
    51     according to settings.DEFAULT_CHARSET. 
     50    A class whose __str__ returns its __unicode__ as a UTF-8 bytestring. 
    5251 
    5352    Useful as a mix-in. 
    5453    """ 
    5554    def __str__(self): 
    56         # XXX: (Malcolm) Correct encoding? Be variable and use UTF-8 as 
    57         # default? 
    58         return self.__unicode__().encode(settings.DEFAULT_CHARSET) 
     55        return self.__unicode__().encode('utf-8') 
    5956