[issue15276] unicode format does not really work in Python 2.x

Petr Dlouhý report at bugs.python.org
Thu Apr 17 16:14:08 CEST 2014


Petr Dlouhý added the comment:

For anyone stuck on Python 2.x, here is an workaround (maybe it could find it's way to documentation also):

  def fix_grouping(bytestring):
      try:
          return unicode(bytestring)
      except UnicodeDecodeError:
          return bytestring.decode("utf-8")

----------
nosy: +petr.dlouhy at email.cz

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15276>
_______________________________________


More information about the Python-bugs-list mailing list