You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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).
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: