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

Undefined unicode characters should be non-printable #47532

Closed
amauryfa opened this issue Jul 4, 2008 · 2 comments
Closed

Undefined unicode characters should be non-printable #47532

amauryfa opened this issue Jul 4, 2008 · 2 comments

Comments

@amauryfa
Copy link
Member

amauryfa commented Jul 4, 2008

BPO 3282
Nosy @birkenfeld, @amauryfa

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 2008-07-04.15:55:28.766>
created_at = <Date 2008-07-04.13:30:04.894>
labels = ['expert-unicode']
title = 'Undefined unicode characters should be non-printable'
updated_at = <Date 2008-07-04.15:55:28.742>
user = 'https://github.com/amauryfa'

bugs.python.org fields:

activity = <Date 2008-07-04.15:55:28.742>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2008-07-04.15:55:28.766>
closer = 'georg.brandl'
components = ['Unicode']
creation = <Date 2008-07-04.13:30:04.894>
creator = 'amaury.forgeotdarc'
dependencies = []
files = []
hgrepos = []
issue_num = 3282
keywords = []
message_count = 2.0
messages = ['69254', '69261']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'amaury.forgeotdarc']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue3282'
versions = ['Python 3.0']

@amauryfa
Copy link
Member Author

amauryfa commented Jul 4, 2008

str.isprintable() returns True for undefined unicode code points:

>>> c = "\ufffe"
>>> unicodedata.category(c)
'Cn'             # (Other, Not Assigned)
>>> c.isprintable()
True

Same for "\u0242", "\ufb12"...

The cause is probably in unicodectype.c: _PyUnicode_IsPrintable():
return (ctype->flags & NONPRINTABLE_MASK) == 0;
but ctype->flags is 0 for undefined chars.

@birkenfeld
Copy link
Member

Should be fixed in r64701...

@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
Projects
None yet
Development

No branches or pull requests

2 participants