This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Characters are garbled when displaying Byte data
Type: behavior Stage: resolved
Components: IO Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, 福永陽平
Priority: normal Keywords:

Created on 2020-02-17 13:51 by 福永陽平, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg362145 - (view) Author: 福永陽平 (福永陽平) Date: 2020-02-17 13:51
Hex data is garbled when displaying received data from serial.

--- code ---
recvMessage = serialPort.readline()
print(recvMessage, end="\r\n")
------------

--- result ---
b'ERXUDP FE80:0000:0000:0000:0280:8700:3015:64F5 FE80:0000:0000:0000:021D:1290:0003:8331 0E1A 0E1A 00808700301564F5 1 0012 \x10\x81\x00\x01\x02\x88\x01\x05\xff\x01r\x01\xe7\x04\x00\x00\x02\x04\r\n'
--------------

Mysterious value of 0x01r.
When the corresponding value is judged, it becomes 0x72.

The correct behavior is...
--- correct result ---
b'ERXUDP FE80:0000:0000:0000:0280:8700:3015:64F5 FE80:0000:0000:0000:021D:1290:0003:8331 0E1A 0E1A 00808700301564F5 1 0012 \x10\x81\x00\x01\x02\x88\x01\x05\xff\x72\x01\xe7\x04\x00\x00\x02\x04\r\n'
--------------
msg362148 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-02-17 14:16
How do you know that isn't what is coming in over the serial port? I don't see any indication that this is a bug in python.

We can't really help you here with this sort of problem. I suggest you take this to the python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
msg362235 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-02-18 20:48
I'm going to close this. But if you have additional information that points to this being a bug in python, we can re-open it.
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83843
2020-02-18 20:48:18eric.smithsetstatus: pending -> closed
resolution: not a bug
messages: + msg362235

stage: resolved
2020-02-17 19:56:34eric.smithsetstatus: open -> pending
2020-02-17 14:16:41eric.smithsetnosy: + eric.smith
messages: + msg362148
2020-02-17 13:51:38福永陽平create