Skip to content

Connecting to NTRIP fails on exception UnicodeDecodeError #93

Closed
@klepo

Description

@klepo

Describe the bug

GNSSNTRIPClient does not work if the server does not return the header in utf-8, but e.g. in cp1250, such as czeposr.cuzk.gov.cz. Connecting to NTRIP fails on exception UnicodeDecodeError('utf-8', b'ICY 200 OK\r\nServer: GNSS Spider 7.9.0.386/1.0\r\nDate: \xfat, 08 \xf8\xedj 2024 13:04:43 GMT', 53, 54, 'invalid start byte')

2024-10-08 16:35:00,817 [ERROR] pygnssutils.gnssntripclient: ConnectionAbortedError("Unable to parse response headers - 'utf-8' codec can't decode byte 0xfa in position 53: invalid start byte"). Retrying in 10 secs (1/5) ...

hdr = hdr.decode().split("\r\n")

The bug has been showing up since version 1.1.0

To Reproduce

Connect to an NTRIP server that returns unsupported utf-8 (or ASCII) characters in the header.

Expected Behaviour

A quick fix might be to replace it with this one
hdr = hdr.decode(errors='backslashreplace').split("\r\n")

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions