entry.comment is str in both Python 2 and Python 3; a reasonable choice
given API constraints, although if you were doing it from scratch you'd
probably make it unicode in Python 2 and str in Python 3 (henceforth
"text").  It's important to distinguish between a byte string that
contains UTF-8-encoded Unicode characters and the Python 2 unicode type.
You can tell the difference by printing it using repr().

The release upgrader sets _() up to be a gettext function that returns
"text".  This will work fine in Python 3, but in Python 2 this means
that we need to take a little more care to combine that with
entry.comment.  I suggest something like this:

  add_comment = " " + _("disabled on upgrade to %s") % self.toDist
  if isinstance(entry.comment, bytes):
      entry.comment += add_comment.encode("UTF-8")
  else:
      entry.comment += add_comment

** Package changed: python-apt (Ubuntu Quantal) => ubuntu-release-
upgrader (Ubuntu Quantal)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1039484

Title:
  Accents in sources.list breaks do-release-upgrade

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1039484/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to