Code

Ticket #3395: decode-before-unicode.patch

File decode-before-unicode.patch, 540 bytes (added by Øyvind Saltvik <oyvind.saltvik@…>, 7 years ago)

This helped me, should this be checked in or is there something i'm missing here?

  • django/newforms/util.py

     
    1010        if hasattr(s, '__unicode__'): 
    1111            s = unicode(s) 
    1212        else: 
    13             s = unicode(str(s), settings.DEFAULT_CHARSET) 
     13            s = unicode(str(s).decode(settings.DEFAULT_CHARSET), (settings.DEFAULT_CHARSET) 
    1414    elif not isinstance(s, unicode): 
    1515        s = unicode(s, settings.DEFAULT_CHARSET) 
    1616    return s