Home > other >  After socket programming paranormal events: the string to encode the send, the other end after recv
After socket programming paranormal events: the string to encode the send, the other end after recv

Time:02-24

Send the string is a function by bytes type into the STR type, I've tested converted back, consistent with the original data, the conversion function is no problem, the string to encode and decode in the end there is no problem, also can get the original string, and then converted into bytes type also and the original data

Client will data by bytes type into the STR type, server send (data) encode (' utf-8) sent to the server, sent successfully, no error,
But the service side the sock. Recv (1024). The decode (' utf-8 ') is always an error:
UnicodeDecodeError: 'utf-8' codec can 't decode byte 0 xc3 position in 1023: unexpected end of data


Is data in the client sends and server-side recv in the process of change? !
  • Related