On Fri, 12 Mar 2010 11:53:16 am Steven D'Aprano wrote: > I have tried to match the behaviour of the built-in unicode as close > as I am able. See here: > http://docs.python.org/library/functions.html#unicode
And by doing so, I entirely forgot that you want to change the default encoding from 'ascii' to 'utf-8'! Oops. Sorry about that. Try changing this bit: > else: # Never attempt decoding. > obj = super(Unicode, cls).__new__(Unicode, string) to this: # Untested else: if isinstance(string, unicode): # Don't do any decoding. obj = super(Unicode, cls).__new__(Unicode, string) else: if encoding is None: encoding = cls._ENCODING if errors is None: errors = cls._ERRORS obj = super(Unicode, cls).__new__( Unicode, string, encoding, errors) You can probably clean up the method to make it a bit tidier. -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor