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

batch/IDLE differ: print broken for chraracters>ascii #47275

Closed
jimjjewett mannequin opened this issue Jun 1, 2008 · 2 comments
Closed

batch/IDLE differ: print broken for chraracters>ascii #47275

jimjjewett mannequin opened this issue Jun 1, 2008 · 2 comments
Assignees
Labels
docs Documentation in the Doc dir topic-unicode type-bug An unexpected behavior, bug, or error

Comments

@jimjjewett
Copy link
Mannequin

jimjjewett mannequin commented Jun 1, 2008

BPO 3025
Nosy @loewis, @birkenfeld

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 = 'https://github.com/birkenfeld'
closed_at = <Date 2008-06-02.05:14:35.619>
created_at = <Date 2008-06-01.23:12:23.688>
labels = ['type-bug', 'expert-unicode', 'docs']
title = 'batch/IDLE differ: print broken for chraracters>ascii'
updated_at = <Date 2008-06-02.05:14:35.589>
user = 'https://bugs.python.org/jimjjewett'

bugs.python.org fields:

activity = <Date 2008-06-02.05:14:35.589>
actor = 'loewis'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-06-02.05:14:35.619>
closer = 'loewis'
components = ['Documentation', 'Unicode']
creation = <Date 2008-06-01.23:12:23.688>
creator = 'jimjjewett'
dependencies = []
files = []
hgrepos = []
issue_num = 3025
keywords = []
message_count = 2.0
messages = ['67617', '67628']
nosy_count = 3.0
nosy_names = ['loewis', 'georg.brandl', 'jimjjewett']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue3025'
versions = ['Python 3.0']

@jimjjewett
Copy link
Mannequin Author

jimjjewett mannequin commented Jun 1, 2008

The str->Unicode change widened IDLE/batch discrepancy.

In python 2.x, bytes are printable.

>> for i in range(256): print i, chr(i)

works fine. In python 3, chr has become (the old) unichr, and whether a
unicode character is printable depends on the environment. In particular,
under my Windows XP, the equivalent

>> for i in range(256): print (i, chr(i))

will still work fine under IDLE, but will now crash with an
UnicodeEncodeError when run from the command line.

----------------

Unfortunately, I'm not sure what the right solution actually is, other than
a mention in the Whats New document.

I believe the 2.5 code was using a system page to print those characters, as
they often looked like letters rather than <control>. Copying that would
probably be the wrong solution.

Limiting IDLE would add consistency, but might be a lot of work for the
equivalent of a --pedantic flag.

PEP-3138 seems to be proposing a default stdout BackslashReplace, which may
at least help.

@jimjjewett jimjjewett mannequin assigned birkenfeld Jun 1, 2008
@jimjjewett jimjjewett mannequin added docs Documentation in the Doc dir topic-unicode type-bug An unexpected behavior, bug, or error labels Jun 1, 2008
@loewis
Copy link
Mannequin

loewis mannequin commented Jun 2, 2008

Whether or not that works in 3k depends on your console's encoding; your
program works just fine for me in Linux, with a UTF-8 console.

Python 2.5 was not using a "system page" (whatever that is); it was
sending the bytes to the terminal as-is, which then could interpret them
according to whatever encoding it choses to. Again, on a UTF-8 terminal,
sending individual bytes above 128 is meaningless, so the console had to
deal with it somehow.

I fail to see a Python problem in this report, so I'm closing it as
"works for me".

@loewis loewis mannequin closed this as completed Jun 2, 2008
@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 topic-unicode type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant