MorseKOB / PyKOB

Python implementation of a library for Morse and MorseKOB functionality
https://sites.google.com/site/morsekob/morsekob40
MIT License
4 stars 2 forks source link

Accept non-ASCII characters in station ID #258

Closed leskerr closed 3 years ago

leskerr commented 3 years ago

I wasn't able to use MKOB 4.0 on wire 11 yesterday. Every time I tried to connect, the program crashed with this error message:

  File "C:\Users\Les\Documents\GitHub\PyKOB\pykob\internet.py", line 113, in read
    stnID, sep, fill = stnID.decode(encoding='ascii').partition(NUL)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 17: ordinal not in range(128)

The problem was a listener on the wire (legitimately) had non-ASCII characters in his station ID. Specifically, the station ID was 'BG Pierre, Ste-Thérèse'.

This is a fairly high priority bug. I'll try to fix it as soon as I can.

AESilky commented 3 years ago

It seems like you should be able to just change the decoding to UTF8.