Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 FAQ mentions unicode() #52940

Closed
ohnobinki mannequin opened this issue May 12, 2010 · 3 comments
Closed

python3 FAQ mentions unicode() #52940

ohnobinki mannequin opened this issue May 12, 2010 · 3 comments
Labels
docs Documentation in the Doc dir

Comments

@ohnobinki
Copy link
Mannequin

ohnobinki mannequin commented May 12, 2010

BPO 8694
Nosy @birkenfeld, @terryjreedy, @ezio-melotti

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:

assignee = None
closed_at = <Date 2010-05-21.20:36:34.340>
created_at = <Date 2010-05-12.06:14:29.170>
labels = ['docs']
title = 'python3 FAQ mentions unicode()'
updated_at = <Date 2010-05-21.20:36:34.338>
user = 'https://bugs.python.org/ohnobinki'

bugs.python.org fields:

activity = <Date 2010-05-21.20:36:34.338>
actor = 'georg.brandl'
assignee = 'docs@python'
closed = True
closed_date = <Date 2010-05-21.20:36:34.340>
closer = 'georg.brandl'
components = ['Documentation']
creation = <Date 2010-05-12.06:14:29.170>
creator = 'ohnobinki'
dependencies = []
files = []
hgrepos = []
issue_num = 8694
keywords = []
message_count = 3.0
messages = ['105574', '105747', '106261']
nosy_count = 5.0
nosy_names = ['georg.brandl', 'terry.reedy', 'ezio.melotti', 'docs@python', 'ohnobinki']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue8694'
versions = ['Python 3.1']

@ohnobinki
Copy link
Mannequin Author

ohnobinki mannequin commented May 12, 2010

http://docs.python.org/py3k/faq/programming.html#what-does-unicodeerror-ascii-decoding-encoding-error-ordinal-not-in-range-128-mean

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.

@ohnobinki ohnobinki mannequin assigned docspython May 12, 2010
@ohnobinki ohnobinki mannequin added the docs Documentation in the Doc dir label May 12, 2010
@terryjreedy
Copy link
Member

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).

@birkenfeld
Copy link
Member

This was due to a review of the programming FAQ not yet having been merged to the 3.1 branch. Now fixed in r81407.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants