Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to NTRIP fails on exception UnicodeDecodeError #93

Closed
klepo opened this issue Oct 8, 2024 · 1 comment · Fixed by #94
Closed

Connecting to NTRIP fails on exception UnicodeDecodeError #93

klepo opened this issue Oct 8, 2024 · 1 comment · Fixed by #94
Assignees
Labels
bug Something isn't working

Comments

@klepo
Copy link

klepo commented Oct 8, 2024

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")

@semuadmin
Copy link
Contributor

semuadmin commented Oct 8, 2024

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

I can see the problematic chars in the SOURCETABLE are út, 08 říj ... i.e. Tue, 08 Oct ..., in which case I think the quick fix you suggest should suffice. Thanks for the report.

@semuadmin semuadmin added the bug Something isn't working label Oct 8, 2024
@semuadmin semuadmin added this to the RC 1.1.4 milestone Oct 8, 2024
@semuadmin semuadmin mentioned this issue Oct 8, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants