mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 06:47:42 +00:00
Fix mojibake in DX cluster and RBN spot comments where the source uses UTF-8
This commit is contained in:
@@ -156,3 +156,13 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo):
|
||||
except (KeyError, ValueError):
|
||||
# Unknown callsign, can't look anything up, return a Callsign object with basic data so that gets cached
|
||||
return Callsign(call=callsign)
|
||||
|
||||
|
||||
def decode_telnet_bytes(data: bytes) -> str:
|
||||
"""Decode a line of text received from a telnet connection, which might be UTF-8 or Latin-1 depending on the
|
||||
whims of the server owner."""
|
||||
|
||||
try:
|
||||
return data.decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
return data.decode("latin-1")
|
||||
|
||||
Reference in New Issue
Block a user