[issue8694] python3 FAQ mentions unicode()

New submission from Nathan Phillip Brink <ohnobinki@ohnopublishing.net>: http://docs.python.org/py3k/faq/programming.html#what-does-unicodeerror-asci... When I try to use unicode() from within python3, the call fails. I would actually expect that the FAQ should contain more information concerning the merging of the unicode and str classes. It would be nice if, when this FAQ entry is updated, there is a short discussion on making the code compatible with both python2 and python3, as it appears that's the only way python3 adaption will ever happen. ---------- assignee: docs@python components: Documentation messages: 105574 nosy: docs@python, ohnobinki priority: normal severity: normal status: open title: python3 FAQ mentions unicode() versions: Python 3.1 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________

Changes by Giampaolo Rodola' <g.rodola@gmail.com>: ---------- nosy: +ezio.melotti _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________

Terry J. Reedy <tjreedy@udel.edu> added the comment: Yes, the faq entry has example code like "value = unicode(value, "utf-8")" This whole section now applies when 'value' is a bytes or bytearray object and one calls str(value). For portability, one should in 2.6/7 use unicode strings as much as possible and the bytes and unicode functions but not the str function. Then 2to3.py will change 'unicode' to 'str'. This should be a separate FAQ entry (if not already), for both 2.x and 3.x, with more complete advice from MLV (from whom I am parroting the above). ---------- nosy: +tjreedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________

Georg Brandl <georg@python.org> added the comment: This was due to a review of the programming FAQ not yet having been merged to the 3.1 branch. Now fixed in r81407. ---------- nosy: +georg.brandl resolution: -> fixed status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________

Changes by Giampaolo Rodola' <g.rodola@gmail.com>: ---------- nosy: +ezio.melotti _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________

Terry J. Reedy <tjreedy@udel.edu> added the comment: Yes, the faq entry has example code like "value = unicode(value, "utf-8")" This whole section now applies when 'value' is a bytes or bytearray object and one calls str(value). For portability, one should in 2.6/7 use unicode strings as much as possible and the bytes and unicode functions but not the str function. Then 2to3.py will change 'unicode' to 'str'. This should be a separate FAQ entry (if not already), for both 2.x and 3.x, with more complete advice from MLV (from whom I am parroting the above). ---------- nosy: +tjreedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________

Georg Brandl <georg@python.org> added the comment: This was due to a review of the programming FAQ not yet having been merged to the 3.1 branch. Now fixed in r81407. ---------- nosy: +georg.brandl resolution: -> fixed status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8694> _______________________________________
participants (4)
-
Georg Brandl
-
Giampaolo Rodola'
-
Nathan Phillip Brink
-
Terry J. Reedy