Python Forum
idle and characters with decimal value>127 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: idle and characters with decimal value>127 (/thread-33986.html)

Pages: 1 2


idle and characters with decimal value>127 - hakelm - Jun-16-2021

If I running python 3.8 in the terminal do
print(chr(65)+chr(128))
I get the expected result
A�
but if I execute the same command in idle 2.7.12 the result is just an empty line.
Is this a bug or is it a feature?
H
using Ubuntu 16.04


RE: idle and characters with decimal value>127 - Gribouillis - Jun-16-2021

I think there is no normalized transcription for control characters 128 to 159. In the french Wikipedia page, they advise against using these characters because of the lack of norm. The character shown in the terminal is a placeholder instead of the actual corresponding glyph.


RE: idle and characters with decimal value>127 - supuflounder - Jun-16-2021

(Jun-16-2021, 07:34 AM)hakelm Wrote: If I running python 3.8 in the terminal do
print(chr(65)+chr(128))
I get the expected result
A�
but if I execute the same command in idle 2.7.12 the result is just an empty line.
Is this a bug or is it a feature?
H
using Ubuntu 16.04

Python 2.x is obsolete, and irrelevant to modern programming. So whether it is a bug or a feature is irrelevant. In any case, a single test is not indicative of anything. But just stop using Python 2.x. It is out of support and officially deprecated. See https://www.python.org/doc/sunset-python-2/

And that is not the expected result. The expected result is A€, since the Euro sign is supposed to be in position 128 in most fonts, in the lower 8-bit set. Have you selected the right font for your output window/console? Or do you even have a modern font installed?


RE: idle and characters with decimal value>127 - Gribouillis - Jun-16-2021

Euro sign may be in position 128 for extended ascii, but for unicode it is in position 8364. I wouldn't say € is normally expected to display chr(128). The idle editor correctly displays a euro sign for chr(8364).


RE: idle and characters with decimal value>127 - hakelm - Jun-17-2021

Thanks all,
I didn't realise that my freshly installed idle wasn't up to date and didn't use my python3.
idle3 works better and delivers "proper" results. Below output for 127<ord©<256. All characters aren't displayed the same way as in my idle3.
H
============================ RESTART: /root/c.py ============================
‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
>>>


RE: idle and characters with decimal value>127 - Gribouillis - Jun-17-2021

This output looks very much like latin-1. Note that characters 127 to 160 don't produce visible output.


RE: idle and characters with decimal value>127 - hakelm - Jun-17-2021

Pasting characters 128-160 directly here results in nothing visible.
I don't know what character set idle3 uses but idle3 produces those seen below the only invisible one is chr(160).
[attachment=1144]

It doesnt look exactly as Latin1 or ISO/IEC 8859.


RE: idle and characters with decimal value>127 - Gribouillis - Jun-17-2021

This looks somewhat in contradiction with your previous post. What reproducible steps did you follow to get this output in idle?


RE: idle and characters with decimal value>127 - hakelm - Jun-18-2021

As I said above, I replaced idle with idle3
H


RE: idle and characters with decimal value>127 - Gribouillis - Jun-18-2021

This doesn't tell me which code produced this output.