Winloop icon indicating copy to clipboard operation
Winloop copied to clipboard

error parse bytes

Open IvanKirpichnikov opened this issue 1 year ago • 5 comments

ERROR:asyncio:Unhandled exception in event loop
Traceback (most recent call last):
  File "winloop\dns.pyx", line 448, in winloop.loop.__on_addrinfo_resolved
  File "winloop\errors.pyx", line 72, in winloop.loop.convert_error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdd in position 0: invalid continuation byte

the error appears when I use winloop together in psycopg[binary] version 3.2.1

IvanKirpichnikov avatar Aug 23 '24 12:08 IvanKirpichnikov

it was a problem on my part

IvanKirpichnikov avatar Aug 23 '24 12:08 IvanKirpichnikov

Hi, @IvanKirpichnikov! How did you fix it?

monosans avatar Sep 18 '24 15:09 monosans

Hello. No way. I thought that the problem was on my side, but after a while I realized that it was not on my side.

As a result, I threw out winloop, because the project will still be deployed on Linux :D

IvanKirpichnikov avatar Sep 18 '24 15:09 IvanKirpichnikov

Reopen the issue please

monosans avatar Sep 18 '24 16:09 monosans

Reopen the issue please

done

IvanKirpichnikov avatar Sep 18 '24 18:09 IvanKirpichnikov

@IvanKirpichnikov Sorry for a year of waiting I may have come up with a solution.

msg = system.gai_strerror(sock_err).decode('utf-8', errors="surrogatescape")

do you think surrogateescape will pass 0xdd?

Vizonex avatar Jul 17 '25 22:07 Vizonex

@IvanKirpichnikov Sorry for a year of waiting I may have come up with a solution.

msg = system.gai_strerror(sock_err).decode('utf-8', errors="surrogatescape")

do you think surrogateescape will pass 0xdd?

Hi. Thanks for the solution, but I can't test it. I switched to linux =(

IvanKirpichnikov avatar Jul 18 '25 10:07 IvanKirpichnikov

I think I should have attached the MRE.

All I know is winloop==0.1.6 was used together with psycopg[binary]==3.2.1. And the problem appeared when connecting to PostgreSQL. It may have appeared when an unsuccessful attempt was made to connect to the database.

IvanKirpichnikov avatar Jul 18 '25 10:07 IvanKirpichnikov

I think I should have attached the MRE.

All I know is winloop==0.1.6 was used together with psycopg[binary]==3.2.1. And the problem appeared when connecting to PostgreSQL. It may have appeared when an unsuccessful attempt was made to connect to the database.

@IvanKirpichnikov I wrote a reproducible test that should work on any os in the pull request. should also work on linux but incase I'll copy and paste that same snippet here.

e = b'\xdd'
print(e.decode('utf-8',"surrogateescape"))

Vizonex avatar Jul 18 '25 15:07 Vizonex