Ticket #3344: temporary-fix-until-full-unicode.patch
File temporary-fix-until-full-unicode.patch, 1.1 KB (added by , 18 years ago) |
---|
-
django/newforms/util.py
12 12 s = unicode(s, settings.DEFAULT_CHARSET) 13 13 return s 14 14 15 def charrefs(s): 16 s = s.decode('utf-8').encode('ascii', 'xmlcharrefreplace') 17 return s 18 15 19 class StrAndUnicode(object): 16 20 """ 17 21 A class whose __str__ returns its __unicode__ as a bytestring … … 57 61 def __init__(self, message): 58 62 "ValidationError can be passed a string or a list." 59 63 if isinstance(message, list): 60 self.messages = ErrorList([smart_unicode( msg) for msg in message])64 self.messages = ErrorList([smart_unicode(charrefs(msg)) for msg in message]) 61 65 else: 62 66 assert isinstance(message, basestring), ("%s should be a basestring" % repr(message)) 63 message = smart_unicode( message)67 message = smart_unicode(charrefs(message)) 64 68 self.messages = ErrorList([message]) 65 69 66 70 def __str__(self):