Closed mgedmin closed 5 years ago
It is still used in several places to do conversions of some kind, e.g.
text = _u(text, charset)
filename = _u(aFieldStorage.filename, 'UTF-8')
title = tname = _u(t)
and (my favourite):
rk = _u(k if type(k) == bytes
else k.encode('latin1'), ENCODING)
rv = _u(v.value if type(v.value) == bytes
else v.value.encode('latin1'), ENCODING)
I will replace these in a separate PR, when my mind works a bit better.
The
_u()
compat function was necessary to support Python 3.0 and 3.1 which did not allow u-literals. Today it only makes the code harder to read and understand.